1
1
( function ( $ ) {
2
-
2
+
3
3
function methodTest ( methodName ) {
4
4
var v = jQuery ( "#form" ) . validate ( ) ;
5
5
var method = $ . validator . methods [ methodName ] ;
@@ -121,7 +121,7 @@ test("number", function() {
121
121
ok ( ! method ( "123.0.0,0" ) , "Invalid number" ) ;
122
122
ok ( ! method ( "x123" ) , "Invalid number" ) ;
123
123
ok ( ! method ( "100.100,0,0" ) , "Invalid number" ) ;
124
-
124
+
125
125
ok ( method ( "" ) , "Blank is valid" ) ;
126
126
ok ( method ( "123" ) , "Valid decimal" ) ;
127
127
ok ( method ( "123000" ) , "Valid decimal" ) ;
@@ -149,7 +149,7 @@ test("numberDE", function() {
149
149
ok(!method( "123,0,0.0" ), "Invalid numberDE" );
150
150
ok(!method( "x123" ), "Invalid numberDE" );
151
151
ok(!method( "100,100.0.0" ), "Invalid numberDE" );
152
-
152
+
153
153
ok( method( "" ), "Blank is valid" );
154
154
ok( method( "123" ), "Valid decimalDE" );
155
155
ok( method( "123000" ), "Valid decimalDE" );
@@ -200,25 +200,25 @@ test("required", function() {
200
200
ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] ) , "Valid text input" ) ;
201
201
ok ( ! method . call ( v , e [ 1 ] . value , e [ 1 ] ) , "Invalid text input" ) ;
202
202
ok ( ! method . call ( v , e [ 1 ] . value , e [ 2 ] ) , "Invalid text input" ) ;
203
-
203
+
204
204
ok ( ! method . call ( v , e [ 2 ] . value , e [ 3 ] ) , "Invalid select" ) ;
205
205
ok ( method . call ( v , e [ 3 ] . value , e [ 4 ] ) , "Valid select" ) ;
206
-
206
+
207
207
e = $ ( '#area1, #area2, #pw1, #pw2' ) ;
208
208
ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] ) , "Valid textarea" ) ;
209
209
ok ( ! method . call ( v , e [ 1 ] . value , e [ 1 ] ) , "Invalid textarea" ) ;
210
210
ok ( method . call ( v , e [ 2 ] . value , e [ 2 ] ) , "Valid password input" ) ;
211
211
ok ( ! method . call ( v , e [ 3 ] . value , e [ 3 ] ) , "Invalid password input" ) ;
212
-
212
+
213
213
e = $ ( '#radio1, #radio2, #radio3' ) ;
214
214
ok ( ! method . call ( v , e [ 0 ] . value , e [ 0 ] ) , "Invalid radio" ) ;
215
215
ok ( method . call ( v , e [ 1 ] . value , e [ 1 ] ) , "Valid radio" ) ;
216
216
ok ( method . call ( v , e [ 2 ] . value , e [ 2 ] ) , "Valid radio" ) ;
217
-
217
+
218
218
e = $ ( '#check1, #check2' ) ;
219
219
ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] ) , "Valid checkbox" ) ;
220
220
ok ( ! method . call ( v , e [ 1 ] . value , e [ 1 ] ) , "Invalid checkbox" ) ;
221
-
221
+
222
222
e = $ ( '#select1, #select2, #select3, #select4' ) ;
223
223
ok ( ! method . call ( v , e [ 0 ] . value , e [ 0 ] ) , "Invalid select" ) ;
224
224
ok ( method . call ( v , e [ 1 ] . value , e [ 1 ] ) , "Valid select" ) ;
@@ -253,12 +253,12 @@ test("minlength", function() {
253
253
ok ( ! method . call ( v , e [ 1 ] . value , e [ 1 ] , param ) , "Invalid text input" ) ;
254
254
ok ( ! method . call ( v , e [ 2 ] . value , e [ 2 ] , param ) , "Invalid text input" ) ;
255
255
ok ( method . call ( v , e [ 3 ] . value , e [ 3 ] , param ) , "Valid text input" ) ;
256
-
256
+
257
257
e = $ ( '#check1, #check2, #check3' ) ;
258
258
ok ( ! method . call ( v , e [ 0 ] . value , e [ 0 ] , param ) , "Valid checkbox" ) ;
259
259
ok ( method . call ( v , e [ 1 ] . value , e [ 1 ] , param ) , "Valid checkbox" ) ;
260
260
ok ( method . call ( v , e [ 2 ] . value , e [ 2 ] , param ) , "Invalid checkbox" ) ;
261
-
261
+
262
262
e = $ ( '#select1, #select2, #select3, #select4, #select5' ) ;
263
263
ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] , param ) , "Valid select " + e [ 0 ] . id ) ;
264
264
ok ( ! method . call ( v , e [ 1 ] . value , e [ 1 ] , param ) , "Invalid select " + e [ 1 ] . id ) ;
@@ -275,12 +275,12 @@ test("maxlength", function() {
275
275
ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] , param ) , "Valid text input" ) ;
276
276
ok ( method . call ( v , e [ 1 ] . value , e [ 1 ] , param ) , "Valid text input" ) ;
277
277
ok ( ! method . call ( v , e [ 2 ] . value , e [ 2 ] , param ) , "Invalid text input" ) ;
278
-
278
+
279
279
e = $ ( '#check1, #check2, #check3' ) ;
280
280
ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] , param ) , "Valid checkbox" ) ;
281
281
ok ( method . call ( v , e [ 1 ] . value , e [ 1 ] , param ) , "Invalid checkbox" ) ;
282
282
ok ( ! method . call ( v , e [ 2 ] . value , e [ 2 ] , param ) , "Invalid checkbox" ) ;
283
-
283
+
284
284
e = $ ( '#select1, #select2, #select3, #select4' ) ;
285
285
ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] , param ) , "Valid select" ) ;
286
286
ok ( method . call ( v , e [ 1 ] . value , e [ 1 ] , param ) , "Valid select" ) ;
@@ -349,7 +349,7 @@ test("accept", function() {
349
349
ok ( method ( "picture.jpeg" ) , "Valid default accept type" ) ;
350
350
ok ( method ( "picture.png" ) , "Valid default accept type" ) ;
351
351
ok ( ! method ( "picture.pgn" ) , "Invalid default accept type" ) ;
352
-
352
+
353
353
var v = jQuery ( "#form" ) . validate ( ) ,
354
354
method = function ( value , param ) {
355
355
return $ . validator . methods . accept . call ( v , value , $ ( '#text1' ) [ 0 ] , param )
@@ -359,7 +359,7 @@ test("accept", function() {
359
359
ok ( method ( "picture.pdf" , "pdf|doc" ) , "Valid custom accept type" ) ;
360
360
ok ( ! method ( "picture.pdf" , "doc" ) , "Invalid custom accept type" ) ;
361
361
ok ( ! method ( "picture.doc" , "pdf" ) , "Invalid custom accept type" ) ;
362
-
362
+
363
363
ok ( method ( "picture.pdf" , "doc,pdf" ) , "Valid custom accept type, comma seperated" ) ;
364
364
ok ( method ( "picture.pdf" , "pdf,doc" ) , "Valid custom accept type, comma seperated" ) ;
365
365
ok ( ! method ( "picture.pdf" , "gop,top" ) , "Invalid custom accept type, comma seperated" ) ;
@@ -390,7 +390,7 @@ test("remote", function() {
390
390
$ ( document ) . unbind ( "ajaxStop" ) ;
391
391
equals ( 1 , v . size ( ) , "There must be one error" ) ;
392
392
equals ( "Peter in use" , v . errorList [ 0 ] . message ) ;
393
-
393
+
394
394
$ ( document ) . ajaxStop ( function ( ) {
395
395
$ ( document ) . unbind ( "ajaxStop" ) ;
396
396
equals ( 1 , v . size ( ) , "There must be one error" ) ;
@@ -538,12 +538,12 @@ test('creditcardtypes, all', function() {
538
538
}
539
539
}
540
540
} ) ;
541
-
541
+
542
542
testCardTypeByNumber ( "4111-1111-1111-1111" , "VISA" , true )
543
543
testCardTypeByNumber ( "5111-1111-1111-1118" , "MasterCard" , true )
544
544
testCardTypeByNumber ( "6111-1111-1111-1116" , "Discover" , true )
545
545
testCardTypeByNumber ( "3400-0000-0000-009" , "AMEX" , true ) ;
546
-
546
+
547
547
testCardTypeByNumber ( "4111-1111-1111-1110" , "VISA" , false )
548
548
testCardTypeByNumber ( "5432-1111-1111-1111" , "MasterCard" , false )
549
549
testCardTypeByNumber ( "6611-6611-6611-6611" , "Discover" , false )
@@ -562,7 +562,7 @@ test('creditcardtypes, visa', function() {
562
562
}
563
563
}
564
564
} ) ;
565
-
565
+
566
566
testCardTypeByNumber ( "4111-1111-1111-1111" , "VISA" , true )
567
567
testCardTypeByNumber ( "5111-1111-1111-1118" , "MasterCard" , false )
568
568
testCardTypeByNumber ( "6111-1111-1111-1116" , "Discover" , false )
@@ -580,7 +580,7 @@ test('creditcardtypes, mastercard', function() {
580
580
}
581
581
}
582
582
} ) ;
583
-
583
+
584
584
testCardTypeByNumber ( "5111-1111-1111-1118" , "MasterCard" , true )
585
585
testCardTypeByNumber ( "6111-1111-1111-1116" , "Discover" , false )
586
586
testCardTypeByNumber ( "3400-0000-0000-009" , "AMEX" , false ) ;
0 commit comments