mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-20 09:11:40 +01:00
JSHint: Apply onevar to tests
This commit is contained in:
45
test/aria.js
45
test/aria.js
@@ -1,8 +1,9 @@
|
|||||||
module("aria");
|
module("aria");
|
||||||
|
|
||||||
test("Invalid field adds aria-invalid=true", function() {
|
test("Invalid field adds aria-invalid=true", function() {
|
||||||
var ariaInvalidFirstName = $("#ariaInvalidFirstName");
|
var ariaInvalidFirstName = $("#ariaInvalidFirstName"),
|
||||||
var form = $("#ariaInvalid");
|
form = $("#ariaInvalid");
|
||||||
|
|
||||||
form.validate({
|
form.validate({
|
||||||
rules: {
|
rules: {
|
||||||
ariaInvalidFirstName: "required"
|
ariaInvalidFirstName: "required"
|
||||||
@@ -14,8 +15,9 @@ test("Invalid field adds aria-invalid=true", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("Valid field adds aria-invalid=false", function() {
|
test("Valid field adds aria-invalid=false", function() {
|
||||||
var ariaInvalidFirstName = $("#ariaInvalidFirstName");
|
var ariaInvalidFirstName = $("#ariaInvalidFirstName"),
|
||||||
var form = $("#ariaInvalid");
|
form = $("#ariaInvalid");
|
||||||
|
|
||||||
form.validate({
|
form.validate({
|
||||||
rules: {
|
rules: {
|
||||||
ariaInvalidFirstName: "required"
|
ariaInvalidFirstName: "required"
|
||||||
@@ -28,13 +30,14 @@ test("Valid field adds aria-invalid=false", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("resetForm(): removes all aria-invalid attributes", function() {
|
test("resetForm(): removes all aria-invalid attributes", function() {
|
||||||
var ariaInvalidFirstName = $("#ariaInvalidFirstName");
|
var ariaInvalidFirstName = $("#ariaInvalidFirstName"),
|
||||||
var form = $("#ariaInvalid");
|
form = $("#ariaInvalid"),
|
||||||
var validator = form.validate({
|
validator = form.validate({
|
||||||
rules: {
|
rules: {
|
||||||
ariaInvalidFirstName: "required"
|
ariaInvalidFirstName: "required"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ariaInvalidFirstName.val("not empty");
|
ariaInvalidFirstName.val("not empty");
|
||||||
ariaInvalidFirstName.valid();
|
ariaInvalidFirstName.valid();
|
||||||
validator.resetForm();
|
validator.resetForm();
|
||||||
@@ -42,29 +45,33 @@ test("resetForm(): removes all aria-invalid attributes", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("Static required field adds aria-required", function() {
|
test("Static required field adds aria-required", function() {
|
||||||
var ariaRequiredStatic = $("#ariaRequiredStatic");
|
var ariaRequiredStatic = $("#ariaRequiredStatic"),
|
||||||
var form = $("#ariaRequired");
|
form = $("#ariaRequired");
|
||||||
|
|
||||||
form.validate();
|
form.validate();
|
||||||
equal(ariaRequiredStatic.attr("aria-required"), "true");
|
equal(ariaRequiredStatic.attr("aria-required"), "true");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Data required field adds aria-required", function() {
|
test("Data required field adds aria-required", function() {
|
||||||
var ariaRequiredData = $("#ariaRequiredData");
|
var ariaRequiredData = $("#ariaRequiredData"),
|
||||||
var form = $("#ariaRequired");
|
form = $("#ariaRequired");
|
||||||
|
|
||||||
form.validate();
|
form.validate();
|
||||||
equal(ariaRequiredData.attr("aria-required"), "true");
|
equal(ariaRequiredData.attr("aria-required"), "true");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Class required field adds aria-required", function() {
|
test("Class required field adds aria-required", function() {
|
||||||
var ariaRequiredClass = $("#ariaRequiredClass");
|
var ariaRequiredClass = $("#ariaRequiredClass"),
|
||||||
var form = $("#ariaRequired");
|
form = $("#ariaRequired");
|
||||||
|
|
||||||
form.validate();
|
form.validate();
|
||||||
equal(ariaRequiredClass.attr("aria-required"), "true");
|
equal(ariaRequiredClass.attr("aria-required"), "true");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Dynamically required field adds aria-required after valid()", function() {
|
test("Dynamically required field adds aria-required after valid()", function() {
|
||||||
var ariaRequiredDynamic = $("#ariaRequiredDynamic");
|
var ariaRequiredDynamic = $("#ariaRequiredDynamic"),
|
||||||
var form = $("#ariaRequired");
|
form = $("#ariaRequired");
|
||||||
|
|
||||||
form.resetForm();
|
form.resetForm();
|
||||||
form.validate({
|
form.validate({
|
||||||
rules: {
|
rules: {
|
||||||
|
|||||||
@@ -40,15 +40,17 @@ test("group error messages", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("read messages from metadata", function() {
|
test("read messages from metadata", function() {
|
||||||
var form = $("#testForm9");
|
var form = $("#testForm9"),
|
||||||
|
e, g;
|
||||||
|
|
||||||
form.validate();
|
form.validate();
|
||||||
var e = $("#testEmail9");
|
e = $("#testEmail9");
|
||||||
e.valid();
|
e.valid();
|
||||||
equal( form.find("label[for=testEmail9]").text(), "required" );
|
equal( form.find("label[for=testEmail9]").text(), "required" );
|
||||||
e.val("bla").valid();
|
e.val("bla").valid();
|
||||||
equal( form.find("label[for=testEmail9]").text(), "email" );
|
equal( form.find("label[for=testEmail9]").text(), "email" );
|
||||||
|
|
||||||
var g = $("#testGeneric9");
|
g = $("#testGeneric9");
|
||||||
g.valid();
|
g.valid();
|
||||||
equal( form.find("label[for=testGeneric9]").text(), "generic");
|
equal( form.find("label[for=testGeneric9]").text(), "generic");
|
||||||
g.val("bla").valid();
|
g.val("bla").valid();
|
||||||
|
|||||||
166
test/methods.js
166
test/methods.js
@@ -1,9 +1,10 @@
|
|||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
function methodTest( methodName ) {
|
function methodTest( methodName ) {
|
||||||
var v = jQuery("#form").validate();
|
var v = jQuery("#form").validate(),
|
||||||
var method = $.validator.methods[methodName];
|
method = $.validator.methods[methodName],
|
||||||
var element = $("#firstname")[0];
|
element = $("#firstname")[0];
|
||||||
|
|
||||||
return function(value, param) {
|
return function(value, param) {
|
||||||
element.value = value;
|
element.value = value;
|
||||||
return method.call( v, value, element, param );
|
return method.call( v, value, element, param );
|
||||||
@@ -244,10 +245,11 @@ test("minlength", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("maxlength", function() {
|
test("maxlength", function() {
|
||||||
var v = jQuery("#form").validate();
|
var v = jQuery("#form").validate(),
|
||||||
var method = $.validator.methods.maxlength,
|
method = $.validator.methods.maxlength,
|
||||||
param = 4,
|
param = 4,
|
||||||
e = $("#text1, #text2, #text3");
|
e = $("#text1, #text2, #text3");
|
||||||
|
|
||||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||||
@@ -265,49 +267,54 @@ test("maxlength", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("rangelength", function() {
|
test("rangelength", function() {
|
||||||
var v = jQuery("#form").validate();
|
var v = jQuery("#form").validate(),
|
||||||
var method = $.validator.methods.rangelength,
|
method = $.validator.methods.rangelength,
|
||||||
param = [2, 4],
|
param = [2, 4],
|
||||||
e = $("#text1, #text2, #text3");
|
e = $("#text1, #text2, #text3");
|
||||||
|
|
||||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid text input" );
|
ok(!method.call( v, e[1].value, e[1], param), "Invalid text input" );
|
||||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("min", function() {
|
test("min", function() {
|
||||||
var v = jQuery("#form").validate();
|
var v = jQuery("#form").validate(),
|
||||||
var method = $.validator.methods.min,
|
method = $.validator.methods.min,
|
||||||
param = 8,
|
param = 8,
|
||||||
e = $("#value1, #value2, #value3");
|
e = $("#value1, #value2, #value3");
|
||||||
|
|
||||||
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
||||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||||
ok( method.call( v, e[2].value, e[2], param), "Valid text input" );
|
ok( method.call( v, e[2].value, e[2], param), "Valid text input" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("max", function() {
|
test("max", function() {
|
||||||
var v = jQuery("#form").validate();
|
var v = jQuery("#form").validate(),
|
||||||
var method = $.validator.methods.max,
|
method = $.validator.methods.max,
|
||||||
param = 12,
|
param = 12,
|
||||||
e = $("#value1, #value2, #value3");
|
e = $("#value1, #value2, #value3");
|
||||||
|
|
||||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("range", function() {
|
test("range", function() {
|
||||||
var v = jQuery("#form").validate();
|
var v = jQuery("#form").validate(),
|
||||||
var method = $.validator.methods.range,
|
method = $.validator.methods.range,
|
||||||
param = [4,12],
|
param = [4,12],
|
||||||
e = $("#value1, #value2, #value3");
|
e = $("#value1, #value2, #value3");
|
||||||
|
|
||||||
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
||||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("equalTo", function() {
|
test("equalTo", function() {
|
||||||
var v = jQuery("#form").validate();
|
var v = jQuery("#form").validate(),
|
||||||
var method = $.validator.methods.equalTo,
|
method = $.validator.methods.equalTo,
|
||||||
e = $("#text1, #text2");
|
e = $("#text1, #text2");
|
||||||
|
|
||||||
ok( method.call( v, "Test", e[0], "#text1" ), "Text input" );
|
ok( method.call( v, "Test", e[0], "#text1" ), "Text input" );
|
||||||
ok( method.call( v, "T", e[1], "#text2" ), "Another one" );
|
ok( method.call( v, "T", e[1], "#text2" ), "Another one" );
|
||||||
});
|
});
|
||||||
@@ -321,14 +328,15 @@ test("creditcard", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("extension", function() {
|
test("extension", function() {
|
||||||
var method = methodTest("extension");
|
var method = methodTest("extension"),
|
||||||
|
v;
|
||||||
ok( method( "picture.gif" ), "Valid default accept type" );
|
ok( method( "picture.gif" ), "Valid default accept type" );
|
||||||
ok( method( "picture.jpg" ), "Valid default accept type" );
|
ok( method( "picture.jpg" ), "Valid default accept type" );
|
||||||
ok( method( "picture.jpeg" ), "Valid default accept type" );
|
ok( method( "picture.jpeg" ), "Valid default accept type" );
|
||||||
ok( method( "picture.png" ), "Valid default accept type" );
|
ok( method( "picture.png" ), "Valid default accept type" );
|
||||||
ok(!method( "picture.pgn" ), "Invalid default accept type" );
|
ok(!method( "picture.pgn" ), "Invalid default accept type" );
|
||||||
|
|
||||||
var v = jQuery("#form").validate();
|
v = jQuery("#form").validate();
|
||||||
method = function(value, param) {
|
method = function(value, param) {
|
||||||
return $.validator.methods.extension.call(v, value, $("#text1")[0], param);
|
return $.validator.methods.extension.call(v, value, $("#text1")[0], param);
|
||||||
};
|
};
|
||||||
@@ -346,24 +354,25 @@ test("extension", function() {
|
|||||||
test("remote", function() {
|
test("remote", function() {
|
||||||
expect(7);
|
expect(7);
|
||||||
stop();
|
stop();
|
||||||
var e = $("#username");
|
var e = $("#username"),
|
||||||
var v = $("#userForm").validate({
|
v = $("#userForm").validate({
|
||||||
rules: {
|
rules: {
|
||||||
username: {
|
username: {
|
||||||
required: true,
|
required: true,
|
||||||
remote: "users.php"
|
remote: "users.php"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
username: {
|
||||||
|
required: "Please",
|
||||||
|
remote: jQuery.validator.format("{0} in use")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitHandler: function() {
|
||||||
|
ok( false, "submitHandler may never be called when validating only elements");
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
messages: {
|
|
||||||
username: {
|
|
||||||
required: "Please",
|
|
||||||
remote: jQuery.validator.format("{0} in use")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
submitHandler: function() {
|
|
||||||
ok( false, "submitHandler may never be called when validating only elements");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$(document).ajaxStop(function() {
|
$(document).ajaxStop(function() {
|
||||||
$(document).unbind("ajaxStop");
|
$(document).unbind("ajaxStop");
|
||||||
equal( 1, v.size(), "There must be one error" );
|
equal( 1, v.size(), "There must be one error" );
|
||||||
@@ -418,23 +427,24 @@ test("remote, customized ajax options", function() {
|
|||||||
test("remote extensions", function() {
|
test("remote extensions", function() {
|
||||||
expect(5);
|
expect(5);
|
||||||
stop();
|
stop();
|
||||||
var e = $("#username");
|
var e = $("#username"),
|
||||||
var v = $("#userForm").validate({
|
v = $("#userForm").validate({
|
||||||
rules: {
|
rules: {
|
||||||
username: {
|
username: {
|
||||||
required: true,
|
required: true,
|
||||||
remote: "users2.php"
|
remote: "users2.php"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
username: {
|
||||||
|
required: "Please"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitHandler: function() {
|
||||||
|
ok( false, "submitHandler may never be called when validating only elements");
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
messages: {
|
|
||||||
username: {
|
|
||||||
required: "Please"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
submitHandler: function() {
|
|
||||||
ok( false, "submitHandler may never be called when validating only elements");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$(document).ajaxStop(function() {
|
$(document).ajaxStop(function() {
|
||||||
$(document).unbind("ajaxStop");
|
$(document).unbind("ajaxStop");
|
||||||
if ( v.size() !== 0 ) {
|
if ( v.size() !== 0 ) {
|
||||||
@@ -453,9 +463,11 @@ test("remote extensions", function() {
|
|||||||
test("remote radio correct value sent", function() {
|
test("remote radio correct value sent", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
stop();
|
stop();
|
||||||
var e = $("#testForm10Radio2");
|
var e = $("#testForm10Radio2"),
|
||||||
|
v;
|
||||||
|
|
||||||
e.attr("checked", "checked");
|
e.attr("checked", "checked");
|
||||||
var v = $("#testForm10").validate({
|
v = $("#testForm10").validate({
|
||||||
rules: {
|
rules: {
|
||||||
testForm10Radio: {
|
testForm10Radio: {
|
||||||
required: true,
|
required: true,
|
||||||
@@ -477,24 +489,25 @@ test("remote radio correct value sent", function() {
|
|||||||
test("remote reset clear old value", function() {
|
test("remote reset clear old value", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
stop();
|
stop();
|
||||||
var e = $("#username");
|
var e = $("#username"),
|
||||||
var v = $("#userForm").validate({
|
v = $("#userForm").validate({
|
||||||
rules: {
|
rules: {
|
||||||
username: {
|
username: {
|
||||||
required: true,
|
required: true,
|
||||||
remote: {
|
remote: {
|
||||||
url: "echo.php",
|
url: "echo.php",
|
||||||
dataFilter: function(data) {
|
dataFilter: function(data) {
|
||||||
var json = JSON.parse(data);
|
var json = JSON.parse(data);
|
||||||
if(json.username === "asdf") {
|
if(json.username === "asdf") {
|
||||||
return "\"asdf is already taken\"";
|
return "\"asdf is already taken\"";
|
||||||
|
}
|
||||||
|
return "\"" + true + "\"";
|
||||||
}
|
}
|
||||||
return "\"" + true + "\"";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
$(document).ajaxStop(function() {
|
$(document).ajaxStop(function() {
|
||||||
var waitTimeout;
|
var waitTimeout;
|
||||||
|
|
||||||
@@ -952,10 +965,12 @@ test("creditcardtypes, mastercard", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function fillFormWithValuesAndExpect(formSelector, inputValues, expected) {
|
function fillFormWithValuesAndExpect(formSelector, inputValues, expected) {
|
||||||
for (var i=0; i < inputValues.length; i++) {
|
var i, actual;
|
||||||
|
|
||||||
|
for (i = 0; i < inputValues.length; i++) {
|
||||||
$(formSelector + " input:eq(" + i + ")").val(inputValues[i]);
|
$(formSelector + " input:eq(" + i + ")").val(inputValues[i]);
|
||||||
}
|
}
|
||||||
var actual = $(formSelector).valid();
|
actual = $(formSelector).valid();
|
||||||
equal(actual, expected, $.validator.format("Filled inputs of form '{0}' with {1} values ({2})", formSelector, inputValues.length, inputValues.toString()));
|
equal(actual, expected, $.validator.format("Filled inputs of form '{0}' with {1} values ({2})", formSelector, inputValues.length, inputValues.toString()));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1137,8 +1152,9 @@ test("cifES", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("maxWords", function(){
|
test("maxWords", function(){
|
||||||
var method = methodTest("maxWords");
|
var method = methodTest("maxWords"),
|
||||||
var maxWords = 6;
|
maxWords = 6;
|
||||||
|
|
||||||
ok( method( "I am a sentence", maxWords), "Max Words");
|
ok( method( "I am a sentence", maxWords), "Max Words");
|
||||||
ok(!method( "I'm way too long for this sentence!", maxWords), "Too many words");
|
ok(!method( "I'm way too long for this sentence!", maxWords), "Too many words");
|
||||||
ok(method( "Don’t “count” me as too long", maxWords), "Right amount of words with smartquotes");
|
ok(method( "Don’t “count” me as too long", maxWords), "Right amount of words with smartquotes");
|
||||||
@@ -1148,8 +1164,9 @@ test("maxWords", function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("minWords", function(){
|
test("minWords", function(){
|
||||||
var method = methodTest("minWords");
|
var method = methodTest("minWords"),
|
||||||
var minWords = 6;
|
minWords = 6;
|
||||||
|
|
||||||
ok(!method( "I am a short sentence", minWords), "Max Words");
|
ok(!method( "I am a short sentence", minWords), "Max Words");
|
||||||
ok( method( "I'm way too long for this sentence!", minWords), "Too many words");
|
ok( method( "I'm way too long for this sentence!", minWords), "Too many words");
|
||||||
ok(!method( "Don’t “count” me as short.", minWords), "Right amount of words with smartquotes");
|
ok(!method( "Don’t “count” me as short.", minWords), "Right amount of words with smartquotes");
|
||||||
@@ -1159,8 +1176,9 @@ test("minWords", function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("rangeWords", function(){
|
test("rangeWords", function(){
|
||||||
var method = methodTest("rangeWords");
|
var method = methodTest("rangeWords"),
|
||||||
var rangeWords = [3,6];
|
rangeWords = [3,6];
|
||||||
|
|
||||||
ok(!method( "I'm going to be longer than “six words!”", rangeWords), "Longer than 6 with smartquotes");
|
ok(!method( "I'm going to be longer than “six words!”", rangeWords), "Longer than 6 with smartquotes");
|
||||||
ok( method( "I'm just the right amount!", rangeWords), "In between");
|
ok( method( "I'm just the right amount!", rangeWords), "In between");
|
||||||
ok( method( "Super short sentence’s.", rangeWords), "Low end");
|
ok( method( "Super short sentence’s.", rangeWords), "Low end");
|
||||||
|
|||||||
@@ -51,14 +51,15 @@ test("rules() - external", function() {
|
|||||||
test("rules() - external - complete form", function() {
|
test("rules() - external - complete form", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
|
|
||||||
var methods = $.extend({}, $.validator.methods);
|
var methods = $.extend({}, $.validator.methods),
|
||||||
var messages = $.extend({}, $.validator.messages);
|
messages = $.extend({}, $.validator.messages),
|
||||||
|
v;
|
||||||
|
|
||||||
$.validator.addMethod("verifyTest", function() {
|
$.validator.addMethod("verifyTest", function() {
|
||||||
ok( true, "method executed" );
|
ok( true, "method executed" );
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
var v = $("#form").validate({
|
v = $("#form").validate({
|
||||||
rules: {
|
rules: {
|
||||||
action: {verifyTest: true}
|
action: {verifyTest: true}
|
||||||
}
|
}
|
||||||
@@ -182,27 +183,27 @@ test("rules(), class and attribute combinations", function() {
|
|||||||
|
|
||||||
test("rules(), dependency checks", function() {
|
test("rules(), dependency checks", function() {
|
||||||
var v = $("#testForm1clean").validate({
|
var v = $("#testForm1clean").validate({
|
||||||
rules: {
|
rules: {
|
||||||
firstname: {
|
firstname: {
|
||||||
min: {
|
min: {
|
||||||
param: 5,
|
param: 5,
|
||||||
depends: function(el) {
|
depends: function(el) {
|
||||||
return (/^a/).test($(el).val());
|
return (/^a/).test($(el).val());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lastname: {
|
||||||
|
max: {
|
||||||
|
param: 12
|
||||||
|
},
|
||||||
|
email: {
|
||||||
|
depends: function() { return true; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
lastname: {
|
|
||||||
max: {
|
|
||||||
param: 12
|
|
||||||
},
|
|
||||||
email: {
|
|
||||||
depends: function() { return true; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
});
|
rules = $("#firstnamec").rules();
|
||||||
|
|
||||||
var rules = $("#firstnamec").rules();
|
|
||||||
equal( 0, v.objectLength(rules) );
|
equal( 0, v.objectLength(rules) );
|
||||||
|
|
||||||
$("#firstnamec").val("ab");
|
$("#firstnamec").val("ab");
|
||||||
|
|||||||
600
test/test.js
600
test/test.js
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user