mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-24 12:13:59 +01:00
Methods: Add additional method for currency
Closes gh-701
This commit is contained in:
committed by
Jörn Zaefferer
parent
a86421131e
commit
1a981b4403
@@ -1166,4 +1166,28 @@ test("rangeWords", function(){
|
||||
ok(!method( "<div>But you can “count” me as too long</div>", rangeWords), "Too many words with smartquotes w/ HTML");
|
||||
});
|
||||
|
||||
test("currency", function() { // Works with any symbol
|
||||
var method = methodTest( "currency" );
|
||||
ok( method( "£9", '£'), "Valid currency" );
|
||||
ok( method( "£9.9", '£'), "Valid currency" );
|
||||
ok( method( "£9.99", '£'), "Valid currency" );
|
||||
ok( method( "£9.90", '£'), "Valid currency" );
|
||||
ok( method( "£9,999.9", '£'), "Valid currency" );
|
||||
ok( method( "£9,999.99", '£'), "Valid currency" );
|
||||
ok( method( "£9,999,999.9", '£'), "Valid currency" );
|
||||
ok( method( "9", ['£', false]), "Valid currency" );
|
||||
ok( method( "9.9", ['£', false]), "Valid currency" );
|
||||
ok( method( "9.99", ['£', false]), "Valid currency" );
|
||||
ok( method( "9.90", ['£', false]), "Valid currency" );
|
||||
ok( method( "9,999.9", ['£', false]), "Valid currency" );
|
||||
ok( method( "9,999.99", ['£', false]), "Valid currency" );
|
||||
ok( method( "9,999,999.9", ['£', false]), "Valid currency" );
|
||||
ok(!method( "9,", '£'), "Invalid currency" );
|
||||
ok(!method( "9,99.99", '£'), "Invalid currency" );
|
||||
ok(!method( "9,", '£'), "Invalid currency" );
|
||||
ok(!method( "9.999", '£'), "Invalid currency" );
|
||||
ok(!method( "9.999", '£'), "Invalid currency" );
|
||||
ok(!method( "9.99,9", '£'), "Invalid currency" );
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
Reference in New Issue
Block a user