diff options
| author | Shyam Seshadri | 2010-06-16 10:32:56 -0700 |
|---|---|---|
| committer | Shyam Seshadri | 2010-06-16 10:32:56 -0700 |
| commit | 769b26b79eb26076c218cb5b57179ee98424bbd7 (patch) | |
| tree | affc0a834a4307bc90a97f4b776d249f0508def2 /test | |
| parent | bbb45a7eed5264a343c191f3abfbe6f6b5d51139 (diff) | |
| download | angular.js-769b26b79eb26076c218cb5b57179ee98424bbd7.tar.bz2 | |
Fix bug with validator not triggering when attributes are bound and fix some typos. Add test for bug
Diffstat (limited to 'test')
| -rw-r--r-- | test/widgetsSpec.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 40f52b8e..a053090e 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -43,7 +43,7 @@ describe("widget", function(){ describe("ng-format", function(){ - it("should farmat text", function(){ + it("should format text", function(){ compile('<input type="Text" name="list" value="a,b,c" ng-format="list"/>'); expect(scope.$get('list')).toEqual(['a', 'b', 'c']); @@ -178,7 +178,18 @@ describe("widget", function(){ expect(element.attr('ng-validation-error')).toEqual('Not a number'); }); - it("should not call validator if undefinde/empty", function(){ + it('should not blow up for validation with bound attributes', function() { + compile('<input type="text" name="price" boo="{{abc}}" ng-required/>'); + expect(element.hasClass('ng-validation-error')).toBeTruthy(); + expect(element.attr('ng-validation-error')).toEqual('Required'); + + scope.$set('price', '123'); + scope.$eval(); + expect(element.hasClass('ng-validation-error')).toBeFalsy(); + expect(element.attr('ng-validation-error')).toBeFalsy(); + }); + + it("should not call validator if undefined/empty", function(){ var lastValue = "NOT_CALLED"; angularValidator.myValidator = function(value){lastValue = value;}; compile('<input type="text" name="url" ng-validate="myValidator"/>'); |
