@@ -1132,4 +1132,37 @@ test("cifES", function() {
11321132 ok ( ! method ( "B-43.522.192" ) , "CIF invalid: dots and dash" ) ;
11331133} ) ;
11341134
1135+ test ( "maxWords" , function ( ) {
1136+ var method = methodTest ( "maxWords" ) ;
1137+ var maxWords = 6 ;
1138+ ok ( method ( "I am a sentence" , maxWords ) , "Max Words" ) ;
1139+ ok ( ! method ( "I'm way too long for this sentence!" , maxWords ) , "Too many words" ) ;
1140+ ok ( method ( "Don’t “count” me as too long" , maxWords ) , "Right amount of words with smartquotes" ) ;
1141+ ok ( ! method ( "But you can “count” me as too long" , maxWords ) , "Too many words with smartquotes" ) ;
1142+ ok ( method ( "<div>Don’t “count” me as too long</div>" , maxWords ) , "Right amount of words with smartquotes w/ HTML" ) ;
1143+ ok ( ! method ( "<div>But you can “count” me as too long</div>" , maxWords ) , "Too many words with smartquotes w/ HTML" ) ;
1144+ } ) ;
1145+
1146+ test ( "minWords" , function ( ) {
1147+ var method = methodTest ( "minWords" ) ;
1148+ var minWords = 6 ;
1149+ ok ( ! method ( "I am a short sentence" , minWords ) , "Max Words" ) ;
1150+ ok ( method ( "I'm way too long for this sentence!" , minWords ) , "Too many words" ) ;
1151+ ok ( ! method ( "Don’t “count” me as short." , minWords ) , "Right amount of words with smartquotes" ) ;
1152+ ok ( method ( "But you can “count” me as too short" , minWords ) , "Too many words with smartquotes" ) ;
1153+ ok ( ! method ( "<div>“Count” me as too short.</div>" , minWords ) , "Right amount of words with smartquotes w/ HTML" ) ;
1154+ ok ( method ( "<div>But you can “count” me as too long</div>" , minWords ) , "Too many words with smartquotes w/ HTML" ) ;
1155+ } ) ;
1156+
1157+ test ( "rangeWords" , function ( ) {
1158+ var method = methodTest ( "rangeWords" ) ;
1159+ var rangeWords = [ 3 , 6 ] ;
1160+ ok ( ! method ( "I'm going to be longer than “six words!”" , rangeWords ) , "Longer than 6 with smartquotes" ) ;
1161+ ok ( method ( "I'm just the right amount!" , rangeWords ) , "In between" ) ;
1162+ ok ( method ( "Super short sentence’s." , rangeWords ) , "Low end" ) ;
1163+ ok ( ! method ( "I" , rangeWords ) , "Too short" ) ;
1164+ ok ( method ( "<div>“Count” me as perfect.</div>" , rangeWords ) , "Right amount of words with smartquotes w/ HTML" ) ;
1165+ ok ( ! method ( "<div>But you can “count” me as too long</div>" , rangeWords ) , "Too many words with smartquotes w/ HTML" ) ;
1166+ } ) ;
1167+
11351168} ) ( jQuery ) ;
0 commit comments