diff options
| author | Misko Hevery | 2010-12-08 16:14:18 -0800 |
|---|---|---|
| committer | Misko Hevery | 2010-12-11 08:27:52 -0800 |
| commit | b225083a21844bdc710b02337dfa1bef5883baf3 (patch) | |
| tree | 56afc35227f6290409809fbfb984363e98dba045 /test/widgetsSpec.js | |
| parent | e84d3334b0604de26821451158a2ea8c3360431f (diff) | |
| download | angular.js-b225083a21844bdc710b02337dfa1bef5883baf3.tar.bz2 | |
Fire $eval only if the value has actually changed on input
Diffstat (limited to 'test/widgetsSpec.js')
| -rw-r--r-- | test/widgetsSpec.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index bff2c4e3..d6cee491 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -42,6 +42,15 @@ describe("widget", function(){ expect(scope.$get('count')).toEqual(2); }); + it('should not trigger eval if value does not change', function(){ + compile('<input type="Text" name="name" value="Misko" ng:change="count = count + 1" ng:init="count=0"/>'); + expect(scope.name).toEqual("Misko"); + expect(scope.count).toEqual(0); + browserTrigger(element, 'keyup'); + expect(scope.name).toEqual("Misko"); + expect(scope.count).toEqual(0); + }); + it('should allow complex refernce binding', function(){ compile('<div ng:init="obj={abc:{}}">'+ '<input type="Text" name="obj[\'abc\'].name" value="Misko""/>'+ |
