Skip to content

Commit

Permalink
fix for issue victorjonsson#137 and added unit tests for victorjonsso…
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjonsson committed Jul 12, 2014
1 parent 42bedab commit 6c739cc
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 20 deletions.
2 changes: 1 addition & 1 deletion form-validator/date.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @website http://formvalidator.net/#location-validators
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.66
* @version 2.1.67
*/
(function($) {

Expand Down
2 changes: 1 addition & 1 deletion form-validator/file.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @website http://formvalidator.net/
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.66
* @version 2.1.67
*/
(function($, window) {

Expand Down
8 changes: 8 additions & 0 deletions form-validator/form-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@
<label class="control-label">Test</label>
<input name="test" data-validation="number" type="text" />
</div>
<div class="form-group">
<label class="control-label">Password</label>
<input name="pass" data-validation="confirmation" type="password" />
</div>
<div class="form-group">
<label class="control-label">Password again</label>
<input name="pass_confirmation" type="password" />
</div>
<p>
<input type="submit" class="button">
<input type="reset" class="button">
Expand Down
2 changes: 1 addition & 1 deletion form-validator/html5.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @website http://formvalidator.net/
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.66
* @version 2.1.67
*/
(function($, window) {

Expand Down
20 changes: 10 additions & 10 deletions form-validator/jquery.form-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @website http://formvalidator.net/
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.66
* @version 2.1.67
*/
(function($) {

Expand Down Expand Up @@ -1269,21 +1269,21 @@
badTelephone : 'You have not given a correct phone number',
badSecurityAnswer : 'You have not given a correct answer to the security question',
badDate : 'You have not given a correct date',
lengthBadStart : 'You must give an answer between ',
lengthBadStart : 'The input value must be between ',
lengthBadEnd : ' characters',
lengthTooLongStart : 'You have given an answer longer than ',
lengthTooShortStart : 'You have given an answer shorter than ',
notConfirmed : 'Values could not be confirmed',
lengthTooLongStart : 'The input value is longer than ',
lengthTooShortStart : 'The input value is shorter than ',
notConfirmed : 'Input values could not be confirmed',
badDomain : 'Incorrect domain value',
badUrl : 'The answer you gave was not a correct URL',
badCustomVal : 'You gave an incorrect answer',
badInt : 'The answer you gave was not a correct number',
badSecurityNumber : 'Your isVsocial security number was incorrect',
badUrl : 'The input value is not a correct URL',
badCustomVal : 'The input value is incorrect',
badInt : 'The input value was not a correct number',
badSecurityNumber : 'Your social security number was incorrect',
badUKVatAnswer : 'Incorrect UK VAT Number',
badStrength : 'The password isn\'t strong enough',
badNumberOfSelectedOptionsStart : 'You have to choose at least ',
badNumberOfSelectedOptionsEnd : ' answers',
badAlphaNumeric : 'The answer you gave must contain only alphanumeric characters ',
badAlphaNumeric : 'The input value can only contain alphanumeric characters ',
badAlphaNumericExtra: ' and ',
wrongFileSize : 'The file you are trying to upload is too large',
wrongFileType : 'The file you are trying to upload is of wrong type',
Expand Down
4 changes: 2 additions & 2 deletions form-validator/jquery.form-validator.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion form-validator/location.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @website http://formvalidator.net/#location-validators
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.66
* @version 2.1.67
*/
(function($) {

Expand Down
23 changes: 22 additions & 1 deletion form-validator/qunit.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

$input = input('sam', {'':'required alphanumeric length', length:'min10', 'error-msg-alphanumeric':'custom for alphanum'}),
mess = $.formUtils.validateInput($input, $.formUtils.LANG, $.formUtils.defaultConfig(), $form);
equal('You have given an answer shorter than 10 characters', mess, 'Incorrect message');
equal('The input value is shorter than 10 characters', mess, 'Incorrect message');

});

Expand Down Expand Up @@ -535,6 +535,27 @@
true,
'Could not validate confirmation'
);

clearForm();

var $inputC = input('value', {'':'confirmation', 'confirm':'input-D'}, {name:'test'}),
$inputD = input('hej', undefined, {name:'input-D'});

result = $.formUtils.validateInput($inputC, $.formUtils.LANG, $.formUtils.defaultConfig(), $form);

equal(
typeof(result) == 'string', // Should be an error message
true,
'Could not check that inputs did not confirmation each other'
);

$inputD.val('value');
result = $.formUtils.validateInput($inputC, $.formUtils.LANG, $.formUtils.defaultConfig(), $form);
equal(
result,
true,
'Could not validate confirmation'
);
});

// TODO: Write more tests...
Expand Down
2 changes: 1 addition & 1 deletion form-validator/security.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* - cvv
*
* @website http://formvalidator.net/#security-validators
* @version 2.1.66
* @version 2.1.67
*/
(function($, window) {

Expand Down
2 changes: 1 addition & 1 deletion form-validator/sweden.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @website http://formvalidator.net/#swedish-validators
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.66
* @version 2.1.67
*/
(function($, window) {

Expand Down
2 changes: 1 addition & 1 deletion form-validator/uk.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @website http://formvalidator.net/#uk-validators
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.66
* @version 2.1.67
*/
$.formUtils.addValidator({
name : 'ukvatnumber',
Expand Down

0 comments on commit 6c739cc

Please sign in to comment.