@@ -36,8 +36,8 @@ test("url", function() {
36
36
ok ( method ( "ftp://bassistance.de/jquery/plugin.php?bla=blu" ) , "Valid url" ) ;
37
37
ok ( method ( "http://www.føtex.dk/" ) , "Valid url, danish unicode characters" ) ;
38
38
ok ( method ( "http://bösendorfer.de/" ) , "Valid url, german unicode characters" ) ;
39
- ok ( method ( "http://192.168.8.5" ) , "Valid IP Address" )
40
- ok ( ! method ( "http://192.168.8." ) , "Invalid IP Address" )
39
+ ok ( method ( "http://192.168.8.5" ) , "Valid IP Address" ) ;
40
+ ok ( ! method ( "http://192.168.8." ) , "Invalid IP Address" ) ;
41
41
ok ( ! method ( "http://bassistance" ) , "Invalid url" ) ; // valid
42
42
ok ( ! method ( "http://bassistance." ) , "Invalid url" ) ; // valid
43
43
ok ( ! method ( "http://bassistance,de" ) , "Invalid url" ) ;
@@ -53,8 +53,8 @@ test("url2 (tld optional)", function() {
53
53
ok ( method ( "ftp://bassistance.de/jquery/plugin.php?bla=blu" ) , "Valid url" ) ;
54
54
ok ( method ( "http://www.føtex.dk/" ) , "Valid url, danish unicode characters" ) ;
55
55
ok ( method ( "http://bösendorfer.de/" ) , "Valid url, german unicode characters" ) ;
56
- ok ( method ( "http://192.168.8.5" ) , "Valid IP Address" )
57
- ok ( ! method ( "http://192.168.8." ) , "Invalid IP Address" )
56
+ ok ( method ( "http://192.168.8.5" ) , "Valid IP Address" ) ;
57
+ ok ( ! method ( "http://192.168.8." ) , "Invalid IP Address" ) ;
58
58
ok ( method ( "http://bassistance" ) , "Invalid url" ) ;
59
59
ok ( method ( "http://bassistance." ) , "Invalid url" ) ;
60
60
ok ( ! method ( "http://bassistance,de" ) , "Invalid url" ) ;
@@ -232,9 +232,9 @@ test("required with dependencies", function() {
232
232
var v = jQuery ( "#form" ) . validate ( ) ,
233
233
method = $ . validator . methods . required ,
234
234
e = $ ( '#hidden2, #select1, #area2, #radio1, #check2' ) ;
235
- ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] , "asffsaa" ) , "Valid text input due to depencie not met" ) ;
235
+ ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] , "asffsaa" ) , "Valid text input due to dependency not met" ) ;
236
236
ok ( ! method . call ( v , e [ 0 ] . value , e [ 0 ] , "input" ) , "Invalid text input" ) ;
237
- ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] , function ( ) { return false ; } ) , "Valid text input due to depencie not met" ) ;
237
+ ok ( method . call ( v , e [ 0 ] . value , e [ 0 ] , function ( ) { return false ; } ) , "Valid text input due to dependency not met" ) ;
238
238
ok ( ! method . call ( v , e [ 0 ] . value , e [ 0 ] , function ( ) { return true ; } ) , "Invalid text input" ) ;
239
239
ok ( method . call ( v , e [ 1 ] . value , e [ 1 ] , "asfsfa" ) , "Valid select due to dependency not met" ) ;
240
240
ok ( ! method . call ( v , e [ 1 ] . value , e [ 1 ] , "input" ) , "Invalid select" ) ;
@@ -488,7 +488,7 @@ asyncTest("remote radio correct value sent", function() {
488
488
start ( ) ;
489
489
}
490
490
}
491
- } ,
491
+ }
492
492
}
493
493
} ) ;
494
494
@@ -572,6 +572,21 @@ test("dateITA", function() {
572
572
ok ( method ( "01/01/1900" ) , "Valid date ITA" ) ;
573
573
ok ( ! method ( "01/13/1990" ) , "Invalid date ITA" ) ;
574
574
ok ( ! method ( "01.01.1900" ) , "Invalid date ITA" ) ;
575
+ ok ( ! method ( "01/01/199" ) , "Invalid date ITA" ) ;
576
+ } ) ;
577
+
578
+ test ( "dateNL" , function ( ) {
579
+ var method = methodTest ( "dateNL" ) ;
580
+ ok ( method ( "01-01-1900" ) , "Valid date NL" ) ;
581
+ ok ( method ( "01.01.1900" ) , "Valid date NL" ) ;
582
+ ok ( method ( "01/01/1900" ) , "Valid date NL" ) ;
583
+ ok ( method ( "01-01-00" ) , "Valid date NL" ) ;
584
+ ok ( method ( "1-01-1900" ) , "Valid date NL" ) ;
585
+ ok ( method ( "10-10-1900" ) , "Valid date NL" ) ;
586
+ ok ( ! method ( "0-01-1900" ) , "Invalid date NL" ) ;
587
+ ok ( ! method ( "00-01-1900" ) , "Invalid date NL" ) ;
588
+ ok ( ! method ( "35-01-1990" ) , "Invalid date NL" ) ;
589
+ ok ( ! method ( "01.01.190" ) , "Invalid date NL" ) ;
575
590
} ) ;
576
591
577
592
test ( "time" , function ( ) {
@@ -584,48 +599,58 @@ test("time", function() {
584
599
ok ( ! method ( "24:00" ) , "Invalid time" ) ;
585
600
ok ( ! method ( "29:59" ) , "Invalid time" ) ;
586
601
ok ( ! method ( "30:00" ) , "Invalid time" ) ;
602
+ ok ( ! method ( "120:00" ) , "Invalid time" ) ;
603
+ ok ( ! method ( "12:001" ) , "Invalid time" ) ;
604
+ ok ( ! method ( "12:00a" ) , "Invalid time" ) ;
587
605
} ) ;
588
606
589
607
test ( "time12h" , function ( ) {
590
608
var method = methodTest ( "time12h" ) ;
591
609
ok ( method ( "12:00 AM" ) , "Valid time, lower bound, am" ) ;
592
610
ok ( method ( "11:59 AM" ) , "Valid time, upper bound, am" ) ;
611
+ ok ( method ( "12:00AM" ) , "Valid time, no space, am" ) ;
612
+ ok ( method ( "12:00PM" ) , "Valid time, no space, pm" ) ;
593
613
ok ( method ( "12:00 PM" ) , "Valid time, lower bound, pm" ) ;
594
614
ok ( method ( "11:59 PM" ) , "Valid time, upper bound, pm" ) ;
595
615
ok ( method ( "11:59 am" ) , "Valid time, also accept lowercase" ) ;
596
616
ok ( method ( "11:59 pm" ) , "Valid time, also accept lowercase" ) ;
617
+ ok ( method ( "1:59 pm" ) , "Valid time, single hour, no leading 0" ) ;
618
+ ok ( method ( "01:59 pm" ) , "Valid time, single hour, leading 0" ) ;
597
619
ok ( ! method ( "12:00" ) , "Invalid time" ) ;
620
+ ok ( ! method ( "9" ) , "Invalid time" ) ;
621
+ ok ( ! method ( "9 am" ) , "Invalid time" ) ;
598
622
ok ( ! method ( "12:61 am" ) , "Invalid time" ) ;
599
623
ok ( ! method ( "13:00 am" ) , "Invalid time" ) ;
624
+ ok ( ! method ( "00:00 am" ) , "Invalid time" ) ;
600
625
} ) ;
601
626
602
627
test ( "minWords" , function ( ) {
603
628
var method = methodTest ( "minWords" ) ;
604
629
ok ( method ( "hello worlds" , 2 ) , "plain text, valid" ) ;
605
- ok ( method ( "<b >hello</b > world" , 2 ) , "html, valid" ) ;
630
+ ok ( method ( "<em >hello</em > world" , 2 ) , "html, valid" ) ;
606
631
ok ( ! method ( "hello" , 2 ) , "plain text, invalid" ) ;
607
- ok ( ! method ( "<b >world</b >" , 2 ) , "html, invalid" ) ;
632
+ ok ( ! method ( "<em >world</em >" , 2 ) , "html, invalid" ) ;
608
633
ok ( ! method ( "world <br/>" , 2 ) , "html, invalid" ) ;
609
634
} ) ;
610
635
611
636
test ( "maxWords" , function ( ) {
612
637
var method = methodTest ( "maxWords" ) ;
613
638
ok ( method ( "hello" , 2 ) , "plain text, valid" ) ;
614
- ok ( method ( "<b >world</b >" , 2 ) , "html, valid" ) ;
639
+ ok ( method ( "<em >world</em >" , 2 ) , "html, valid" ) ;
615
640
ok ( method ( "world <br/>" , 2 ) , "html, valid" ) ;
616
641
ok ( method ( "hello worlds" , 2 ) , "plain text, valid" ) ;
617
- ok ( method ( "<b >hello</b > world" , 2 ) , "html, valid" ) ;
642
+ ok ( method ( "<em >hello</em > world" , 2 ) , "html, valid" ) ;
618
643
ok ( ! method ( "hello 123 world" , 2 ) , "plain text, invalid" ) ;
619
- ok ( ! method ( "<b >hello</b > 123 world" , 2 ) , "html, invalid" ) ;
644
+ ok ( ! method ( "<em >hello</em > 123 world" , 2 ) , "html, invalid" ) ;
620
645
} ) ;
621
646
622
647
test ( "rangeWords" , function ( ) {
623
648
var method = methodTest ( "rangeWords" ) ;
624
649
ok ( method ( "hello" , [ 0 , 2 ] ) , "plain text, valid" ) ;
625
650
ok ( method ( "hello worlds" , [ 0 , 2 ] ) , "plain text, valid" ) ;
626
- ok ( method ( "<b >hello</b > world" , [ 0 , 2 ] ) , "html, valid" ) ;
651
+ ok ( method ( "<em >hello</em > world" , [ 0 , 2 ] ) , "html, valid" ) ;
627
652
ok ( ! method ( "hello worlds what is up" , [ 0 , 2 ] ) , "plain text, invalid" ) ;
628
- ok ( ! method ( "<b >Hello</b > <b >world</b > <b >hello</b >" , [ 0 , 2 ] ) , "html, invalid" ) ;
653
+ ok ( ! method ( "<em >Hello</em > <em >world</em > <em >hello</em >" , [ 0 , 2 ] ) , "html, invalid" ) ;
629
654
} ) ;
630
655
631
656
test ( "pattern" , function ( ) {
@@ -653,16 +678,15 @@ test('creditcardtypes, all', function() {
653
678
}
654
679
} ) ;
655
680
656
- testCardTypeByNumber ( "4111-1111-1111-1111" , "VISA" , true )
657
- testCardTypeByNumber ( "5111-1111-1111-1118" , "MasterCard" , true )
658
- testCardTypeByNumber ( "6111-1111-1111-1116" , "Discover" , true )
681
+ testCardTypeByNumber ( "4111-1111-1111-1111" , "VISA" , true ) ;
682
+ testCardTypeByNumber ( "5111-1111-1111-1118" , "MasterCard" , true ) ;
683
+ testCardTypeByNumber ( "6111-1111-1111-1116" , "Discover" , true ) ;
659
684
testCardTypeByNumber ( "3400-0000-0000-009" , "AMEX" , true ) ;
660
685
661
- testCardTypeByNumber ( "4111-1111-1111-1110" , "VISA" , false )
662
- testCardTypeByNumber ( "5432-1111-1111-1111" , "MasterCard" , false )
663
- testCardTypeByNumber ( "6611-6611-6611-6611" , "Discover" , false )
664
- testCardTypeByNumber ( "3777-7777-7777-7777" , "AMEX" , false )
665
-
686
+ testCardTypeByNumber ( "4111-1111-1111-1110" , "VISA" , false ) ;
687
+ testCardTypeByNumber ( "5432-1111-1111-1111" , "MasterCard" , false ) ;
688
+ testCardTypeByNumber ( "6611-6611-6611-6611" , "Discover" , false ) ;
689
+ testCardTypeByNumber ( "3777-7777-7777-7777" , "AMEX" , false ) ;
666
690
} ) ;
667
691
668
692
test ( 'creditcardtypes, visa' , function ( ) {
@@ -677,9 +701,9 @@ test('creditcardtypes, visa', function() {
677
701
}
678
702
} ) ;
679
703
680
- testCardTypeByNumber ( "4111-1111-1111-1111" , "VISA" , true )
681
- testCardTypeByNumber ( "5111-1111-1111-1118" , "MasterCard" , false )
682
- testCardTypeByNumber ( "6111-1111-1111-1116" , "Discover" , false )
704
+ testCardTypeByNumber ( "4111-1111-1111-1111" , "VISA" , true ) ;
705
+ testCardTypeByNumber ( "5111-1111-1111-1118" , "MasterCard" , false ) ;
706
+ testCardTypeByNumber ( "6111-1111-1111-1116" , "Discover" , false ) ;
683
707
testCardTypeByNumber ( "3400-0000-0000-009" , "AMEX" , false ) ;
684
708
} ) ;
685
709
@@ -695,14 +719,14 @@ test('creditcardtypes, mastercard', function() {
695
719
}
696
720
} ) ;
697
721
698
- testCardTypeByNumber ( "5111-1111-1111-1118" , "MasterCard" , true )
699
- testCardTypeByNumber ( "6111-1111-1111-1116" , "Discover" , false )
722
+ testCardTypeByNumber ( "5111-1111-1111-1118" , "MasterCard" , true ) ;
723
+ testCardTypeByNumber ( "6111-1111-1111-1116" , "Discover" , false ) ;
700
724
testCardTypeByNumber ( "3400-0000-0000-009" , "AMEX" , false ) ;
701
725
testCardTypeByNumber ( "4111-1111-1111-1111" , "VISA" , false ) ;
702
726
} ) ;
703
727
704
728
function fillFormWithValuesAndExpect ( formSelector , inputValues , expected ) {
705
- for ( i = 0 ; i < inputValues . length ; i ++ ) {
729
+ for ( var i = 0 ; i < inputValues . length ; i ++ ) {
706
730
$ ( formSelector + ' input:eq(' + i + ')' ) . val ( inputValues [ i ] ) ;
707
731
}
708
732
var actual = $ ( formSelector ) . valid ( ) ;
0 commit comments