From e0ad7dfcd47196d0aa9271e84b2c4ac26cfda3f4 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 7 Apr 2010 17:24:24 -0700 Subject: seperatio validation and exception handling --- test/BinderTest.js | 12 ++++++------ test/ScopeSpec.js | 2 +- test/ValidatorsTest.js | 2 +- test/directivesSpec.js | 2 +- test/widgetsSpec.js | 14 +++++++------- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'test') 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('
'); 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('