Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b34769e

Browse files
committed
test(ngChange): ensure the view is updated if ngChange changes model
1 parent 912cbdd commit b34769e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/ng/directive/ngChangeSpec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,19 @@ describe('ngChange', function() {
5858
helper.changeInputValueTo('a');
5959
expect(inputElm.val()).toBe('b');
6060
});
61+
62+
63+
it('should set the view if the model is changed by ngChange', function() {
64+
$rootScope.reset = function() {
65+
$rootScope.value = 'a';
66+
};
67+
$rootScope.value = 'a';
68+
var input = helper.compileInput('<input type="text" ng-change="reset()" ng-model="value">');
69+
var inputController = input.controller('ngModel');
70+
71+
$rootScope.$digest();
72+
73+
helper.changeInputValueTo('b');
74+
expect(input.val()).toBe('a');
75+
});
6176
});

0 commit comments

Comments
 (0)