diff options
| author | Igor Minar | 2011-09-16 00:09:33 +0200 |
|---|---|---|
| committer | Igor Minar | 2011-09-16 02:44:35 +0200 |
| commit | 3ace81b92ad00da73c89e7536ac7aa7c6681e30a (patch) | |
| tree | db2fc914f625a0f3acaf0392cc5318d4156ec48a /src/validators.js | |
| parent | 9acf45127e96051e23f28af7650778fe444d8c86 (diff) | |
| download | angular.js-3ace81b92ad00da73c89e7536ac7aa7c6681e30a.tar.bz2 | |
fix(e2e tests): use prop() instead of attr() and quote attributes
Because of changes in jQuery, we need to use element().prop() instead of element().attr() to retrieve className and other element properties.
Additionally all attribute selectors (e.g. input[name=value]) must have value quoted if it contains dots (".").
Diffstat (limited to 'src/validators.js')
| -rw-r--r-- | src/validators.js | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/validators.js b/src/validators.js index 0a69a002..72a995fc 100644 --- a/src/validators.js +++ b/src/validators.js @@ -61,10 +61,10 @@ extend(angularValidator, { <doc:scenario> it('should invalidate non ssn', function(){ var textBox = element('.doc-example-live :input'); - expect(textBox.attr('className')).not().toMatch(/ng-validation-error/); + expect(textBox.prop('className')).not().toMatch(/ng-validation-error/); expect(textBox.val()).toEqual('123-45-6789'); input('ssn').enter('123-45-67890'); - expect(textBox.attr('className')).toMatch(/ng-validation-error/); + expect(textBox.prop('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> @@ -102,17 +102,17 @@ extend(angularValidator, { <doc:scenario> it('should invalidate number', function(){ var n1 = element('.doc-example-live :input[name=n1]'); - expect(n1.attr('className')).not().toMatch(/ng-validation-error/); + expect(n1.prop('className')).not().toMatch(/ng-validation-error/); input('n1').enter('1.x'); - expect(n1.attr('className')).toMatch(/ng-validation-error/); + expect(n1.prop('className')).toMatch(/ng-validation-error/); var n2 = element('.doc-example-live :input[name=n2]'); - expect(n2.attr('className')).not().toMatch(/ng-validation-error/); + expect(n2.prop('className')).not().toMatch(/ng-validation-error/); input('n2').enter('9'); - expect(n2.attr('className')).toMatch(/ng-validation-error/); + expect(n2.prop('className')).toMatch(/ng-validation-error/); var n3 = element('.doc-example-live :input[name=n3]'); - expect(n3.attr('className')).not().toMatch(/ng-validation-error/); + expect(n3.prop('className')).not().toMatch(/ng-validation-error/); input('n3').enter('201'); - expect(n3.attr('className')).toMatch(/ng-validation-error/); + expect(n3.prop('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> @@ -156,17 +156,17 @@ extend(angularValidator, { <doc:scenario> it('should invalidate integer', function(){ var n1 = element('.doc-example-live :input[name=n1]'); - expect(n1.attr('className')).not().toMatch(/ng-validation-error/); + expect(n1.prop('className')).not().toMatch(/ng-validation-error/); input('n1').enter('1.1'); - expect(n1.attr('className')).toMatch(/ng-validation-error/); + expect(n1.prop('className')).toMatch(/ng-validation-error/); var n2 = element('.doc-example-live :input[name=n2]'); - expect(n2.attr('className')).not().toMatch(/ng-validation-error/); + expect(n2.prop('className')).not().toMatch(/ng-validation-error/); input('n2').enter('10.1'); - expect(n2.attr('className')).toMatch(/ng-validation-error/); + expect(n2.prop('className')).toMatch(/ng-validation-error/); var n3 = element('.doc-example-live :input[name=n3]'); - expect(n3.attr('className')).not().toMatch(/ng-validation-error/); + expect(n3.prop('className')).not().toMatch(/ng-validation-error/); input('n3').enter('100.1'); - expect(n3.attr('className')).toMatch(/ng-validation-error/); + expect(n3.prop('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> @@ -200,9 +200,9 @@ extend(angularValidator, { <doc:scenario> it('should invalidate date', function(){ var n1 = element('.doc-example-live :input'); - expect(n1.attr('className')).not().toMatch(/ng-validation-error/); + expect(n1.prop('className')).not().toMatch(/ng-validation-error/); input('text').enter('123/123/123'); - expect(n1.attr('className')).toMatch(/ng-validation-error/); + expect(n1.prop('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> @@ -238,9 +238,9 @@ extend(angularValidator, { <doc:scenario> it('should invalidate email', function(){ var n1 = element('.doc-example-live :input'); - expect(n1.attr('className')).not().toMatch(/ng-validation-error/); + expect(n1.prop('className')).not().toMatch(/ng-validation-error/); input('text').enter('a@b.c'); - expect(n1.attr('className')).toMatch(/ng-validation-error/); + expect(n1.prop('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> @@ -272,9 +272,9 @@ extend(angularValidator, { <doc:scenario> it('should invalidate phone', function(){ var n1 = element('.doc-example-live :input'); - expect(n1.attr('className')).not().toMatch(/ng-validation-error/); + expect(n1.prop('className')).not().toMatch(/ng-validation-error/); input('text').enter('+12345678'); - expect(n1.attr('className')).toMatch(/ng-validation-error/); + expect(n1.prop('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> @@ -310,9 +310,9 @@ extend(angularValidator, { <doc:scenario> it('should invalidate url', function(){ var n1 = element('.doc-example-live :input'); - expect(n1.attr('className')).not().toMatch(/ng-validation-error/); + expect(n1.prop('className')).not().toMatch(/ng-validation-error/); input('text').enter('abc://server/path'); - expect(n1.attr('className')).toMatch(/ng-validation-error/); + expect(n1.prop('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> @@ -345,9 +345,9 @@ extend(angularValidator, { <doc:scenario> it('should invalidate json', function(){ var n1 = element('.doc-example-live :input'); - expect(n1.attr('className')).not().toMatch(/ng-validation-error/); + expect(n1.prop('className')).not().toMatch(/ng-validation-error/); input('json').enter('{name}'); - expect(n1.attr('className')).toMatch(/ng-validation-error/); + expect(n1.prop('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> @@ -417,13 +417,13 @@ extend(angularValidator, { <doc:scenario> it('should change color in delayed way', function(){ var textBox = element('.doc-example-live :input'); - expect(textBox.attr('className')).not().toMatch(/ng-input-indicator-wait/); - expect(textBox.attr('className')).not().toMatch(/ng-validation-error/); + expect(textBox.prop('className')).not().toMatch(/ng-input-indicator-wait/); + expect(textBox.prop('className')).not().toMatch(/ng-validation-error/); input('text').enter('X'); - expect(textBox.attr('className')).toMatch(/ng-input-indicator-wait/); + expect(textBox.prop('className')).toMatch(/ng-input-indicator-wait/); sleep(.6); - expect(textBox.attr('className')).not().toMatch(/ng-input-indicator-wait/); - expect(textBox.attr('className')).toMatch(/ng-validation-error/); + expect(textBox.prop('className')).not().toMatch(/ng-input-indicator-wait/); + expect(textBox.prop('className')).toMatch(/ng-validation-error/); }); </doc:scenario> </doc:example> |
