aboutsummaryrefslogtreecommitdiffstats
path: root/src/validators.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/validators.js')
-rw-r--r--src/validators.js58
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>