aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/selectSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng/directive/selectSpec.js')
-rw-r--r--test/ng/directive/selectSpec.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ng/directive/selectSpec.js b/test/ng/directive/selectSpec.js
index 6fcd1fe0..d270f438 100644
--- a/test/ng/directive/selectSpec.js
+++ b/test/ng/directive/selectSpec.js
@@ -733,6 +733,27 @@ describe('select', function() {
expect(sortedHtml(options[2])).toEqual('<option value="1">3</option>');
});
+ it('should not update selected property of an option element on digest with no change event',
+ function() {
+ createSingleSelect();
+
+ scope.$apply(function() {
+ scope.values = [{name: 'A'}, {name: 'B'}, {name: 'C'}];
+ scope.selected = scope.values[0];
+ });
+
+ var options = element.find('option');
+ var optionToSelect = options.eq(1);
+
+ expect(optionToSelect.text()).toBe('B');
+
+ optionToSelect.prop('selected', true);
+ scope.$digest();
+
+ expect(optionToSelect.prop('selected')).toBe(true);
+ expect(scope.selected).toBe(scope.values[0]);
+ });
+
describe('binding', function() {
it('should bind to scope value', function() {