diff options
| author | Misko Hevery | 2010-04-07 17:24:24 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-04-07 17:24:24 -0700 |
| commit | e0ad7dfcd47196d0aa9271e84b2c4ac26cfda3f4 (patch) | |
| tree | f62565e7318ca6fe83520855292a29231b5f5970 /test | |
| parent | a8aa5af413c068608aa28ef0d48cef1d5ad66485 (diff) | |
| download | angular.js-e0ad7dfcd47196d0aa9271e84b2c4ac26cfda3f4.tar.bz2 | |
seperatio validation and exception handling
Diffstat (limited to 'test')
| -rw-r--r-- | test/BinderTest.js | 12 | ||||
| -rw-r--r-- | test/ScopeSpec.js | 2 | ||||
| -rw-r--r-- | test/ValidatorsTest.js | 2 | ||||
| -rw-r--r-- | test/directivesSpec.js | 2 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 14 |
5 files changed, 16 insertions, 16 deletions
diff --git a/test/BinderTest.js b/test/BinderTest.js index c792f10b..270fd1c7 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -299,20 +299,20 @@ BinderTest.prototype.testIfTextBindingThrowsErrorDecorateTheSpan = function(){ var span = childNode(doc, 0); assertTrue(span.hasClass('ng-exception')); assertEquals('ErrorMsg1', fromJson(span.text())); - assertEquals('"ErrorMsg1"', span.attr('ng-error')); + assertEquals('"ErrorMsg1"', span.attr('ng-exception')); a.scope.$set('error.throw', function(){throw "MyError";}); a.scope.$eval(); span = childNode(doc, 0); assertTrue(span.hasClass('ng-exception')); assertTrue(span.text(), span.text().match('MyError') !== null); - assertEquals('"MyError"', span.attr('ng-error')); + assertEquals('"MyError"', span.attr('ng-exception')); a.scope.$set('error.throw', function(){return "ok";}); a.scope.$eval(); assertFalse(span.hasClass('ng-exception')); assertEquals('ok', span.text()); - assertEquals(null, span.attr('ng-error')); + assertEquals(null, span.attr('ng-exception')); }; BinderTest.prototype.testIfAttrBindingThrowsErrorDecorateTheAttribute = function(){ @@ -322,14 +322,14 @@ BinderTest.prototype.testIfAttrBindingThrowsErrorDecorateTheAttribute = function a.scope.$set('error.throw', function(){throw "ErrorMsg";}); a.scope.$eval(); assertTrue('ng-exception', doc.hasClass('ng-exception')); - assertEquals('"ErrorMsg"', doc.attr('ng-error')); + assertEquals('"ErrorMsg"', doc.attr('ng-exception')); assertEquals('before "ErrorMsg" after', doc.attr('attr')); a.scope.$set('error.throw', function(){ return 'X';}); a.scope.$eval(); assertFalse('!ng-exception', doc.hasClass('ng-exception')); assertEquals('before X after', doc.attr('attr')); - assertEquals(null, doc.attr('ng-error')); + assertEquals(null, doc.attr('ng-exception')); }; @@ -474,7 +474,7 @@ BinderTest.prototype.testActionOnAHrefThrowsError = function(){ }; var input = c.node; input.click(); - assertEquals({a:"abc", b:2}, fromJson(input.attr('ng-error'))); + assertEquals({a:"abc", b:2}, fromJson(input.attr('ng-exception'))); assertTrue("should have an error class", input.hasClass('ng-exception')); // TODO: I think that exception should never get cleared so this portion of test makes no sense diff --git a/test/ScopeSpec.js b/test/ScopeSpec.js index 09f4d875..0665968b 100644 --- a/test/ScopeSpec.js +++ b/test/ScopeSpec.js @@ -78,7 +78,7 @@ describe('scope/model', function(){ var element = jqLite('<div></div>'); var scope = createScope(); scope.$tryEval('throw "myError"', element); - expect(element.attr('ng-error')).toEqual('"myError"'); // errors are jsonified + expect(element.attr('ng-exception')).toEqual('"myError"'); // errors are jsonified expect(element.hasClass('ng-exception')).toBeTruthy(); }); diff --git a/test/ValidatorsTest.js b/test/ValidatorsTest.js index d7da28cd..4dfe6892 100644 --- a/test/ValidatorsTest.js +++ b/test/ValidatorsTest.js @@ -118,7 +118,7 @@ describe('Validator:asynchronous', function(){ expect(input.hasClass('ng-input-indicator-wait')).toBeTruthy(); fn("myError"); expect(input.hasClass('ng-input-indicator-wait')).toBeFalsy(); - expect(input.attr('ng-error')).toEqual("myError"); + expect(input.attr('ng-validation-error')).toEqual("myError"); scope.$element.remove(); }); diff --git a/test/directivesSpec.js b/test/directivesSpec.js index ea442d16..a92e98ee 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -88,7 +88,7 @@ describe("directives", function(){ it('should error on wrong parsing of ng-repeat', function(){ var scope = compile('<ul><li ng-repeat="i dont parse"></li></ul>'); var log = ""; - log += element.attr('ng-error') + ';'; + log += element.attr('ng-exception') + ';'; log += element.hasClass('ng-exception') + ';'; expect(log).toEqual("\"Expected ng-repeat in form of 'item in collection' but got 'i dont parse'.\";true;"); }); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 88ca3f87..b48656f9 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -54,36 +54,36 @@ describe("input widget", function(){ it("should process ng-validation", function(){ compile('<input type="text" name="price" value="abc" ng-validate="number"/>'); expect(element.hasClass('ng-validation-error')).toBeTruthy(); - expect(element.attr('ng-error')).toEqual('Not a number'); + expect(element.attr('ng-validation-error')).toEqual('Not a number'); scope.$set('price', '123'); scope.$eval(); expect(element.hasClass('ng-validation-error')).toBeFalsy(); - expect(element.attr('ng-error')).toBeFalsy(); + expect(element.attr('ng-validation-error')).toBeFalsy(); element.val('x'); element.trigger('keyup'); expect(element.hasClass('ng-validation-error')).toBeTruthy(); - expect(element.attr('ng-error')).toEqual('Not a number'); + expect(element.attr('ng-validation-error')).toEqual('Not a number'); }); it("should process ng-required", function(){ compile('<input type="text" name="price" ng-required/>'); expect(element.hasClass('ng-validation-error')).toBeTruthy(); - expect(element.attr('ng-error')).toEqual('Required'); + expect(element.attr('ng-validation-error')).toEqual('Required'); scope.$set('price', 'xxx'); scope.$eval(); expect(element.hasClass('ng-validation-error')).toBeFalsy(); - expect(element.attr('ng-error')).toBeFalsy(); + expect(element.attr('ng-validation-error')).toBeFalsy(); element.val(''); element.trigger('keyup'); expect(element.hasClass('ng-validation-error')).toBeTruthy(); - expect(element.attr('ng-error')).toEqual('Required'); + expect(element.attr('ng-validation-error')).toEqual('Required'); }); - it("should process ng-required", function() { + it("should process ng-required2", function() { compile('<textarea name="name">Misko</textarea>'); expect(scope.$get('name')).toEqual("Misko"); |
