-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test: Fix misuse of
equal
method & some spacing issues.
- Loading branch information
Showing
6 changed files
with
1,337 additions
and
1,334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
module("aria"); | ||
module( "aria" ); | ||
|
||
test("Invalid field adds aria-invalid=true", function() { | ||
var ariaInvalidFirstName = $("#ariaInvalidFirstName"), | ||
form = $("#ariaInvalid"); | ||
test( "Invalid field adds aria-invalid=true", function() { | ||
var ariaInvalidFirstName = $( "#ariaInvalidFirstName" ), | ||
form = $( "#ariaInvalid" ); | ||
|
||
form.validate({ | ||
form.validate( { | ||
rules: { | ||
ariaInvalidFirstName: "required" | ||
} | ||
}); | ||
ariaInvalidFirstName.val(""); | ||
} ); | ||
ariaInvalidFirstName.val( "" ); | ||
ariaInvalidFirstName.valid(); | ||
equal(ariaInvalidFirstName.attr("aria-invalid"), "true"); | ||
}); | ||
equal( ariaInvalidFirstName.attr( "aria-invalid" ), "true" ); | ||
} ); | ||
|
||
test("Valid field adds aria-invalid=false", function() { | ||
var ariaInvalidFirstName = $("#ariaInvalidFirstName"), | ||
form = $("#ariaInvalid"); | ||
test( "Valid field adds aria-invalid=false", function() { | ||
var ariaInvalidFirstName = $( "#ariaInvalidFirstName" ), | ||
form = $( "#ariaInvalid" ); | ||
|
||
form.validate({ | ||
form.validate( { | ||
rules: { | ||
ariaInvalidFirstName: "required" | ||
} | ||
}); | ||
ariaInvalidFirstName.val("not empty"); | ||
} ); | ||
ariaInvalidFirstName.val( "not empty" ); | ||
ariaInvalidFirstName.valid(); | ||
equal(ariaInvalidFirstName.attr("aria-invalid"), "false"); | ||
equal($("#ariaInvalid [aria-invalid=false]").length, 1); | ||
}); | ||
equal( ariaInvalidFirstName.attr( "aria-invalid" ), "false" ); | ||
equal( $( "#ariaInvalid [aria-invalid=false]" ).length, 1 ); | ||
} ); | ||
|
||
test("resetForm(): removes all aria-invalid attributes", function() { | ||
var ariaInvalidFirstName = $("#ariaInvalidFirstName"), | ||
form = $("#ariaInvalid"), | ||
validator = form.validate({ | ||
test( "resetForm(): removes all aria-invalid attributes", function() { | ||
var ariaInvalidFirstName = $( "#ariaInvalidFirstName" ), | ||
form = $( "#ariaInvalid" ), | ||
validator = form.validate( { | ||
rules: { | ||
ariaInvalidFirstName: "required" | ||
} | ||
}); | ||
} ); | ||
|
||
ariaInvalidFirstName.val("not empty"); | ||
ariaInvalidFirstName.val( "not empty" ); | ||
ariaInvalidFirstName.valid(); | ||
validator.resetForm(); | ||
equal($("#ariaInvalid [aria-invalid]").length, 0, "resetForm() should remove any aria-invalid attributes"); | ||
}); | ||
equal( $( "#ariaInvalid [aria-invalid]" ).length, 0, "resetForm() should remove any aria-invalid attributes" ); | ||
} ); | ||
|
||
test("Static required field adds aria-required", function() { | ||
var ariaRequiredStatic = $("#ariaRequiredStatic"), | ||
form = $("#ariaRequired"); | ||
test( "Static required field adds aria-required", function() { | ||
var ariaRequiredStatic = $( "#ariaRequiredStatic" ), | ||
form = $( "#ariaRequired" ); | ||
|
||
form.validate(); | ||
equal(ariaRequiredStatic.attr("aria-required"), "true"); | ||
}); | ||
equal( ariaRequiredStatic.attr( "aria-required" ), "true" ); | ||
} ); | ||
|
||
test("Data required field adds aria-required", function() { | ||
var ariaRequiredData = $("#ariaRequiredData"), | ||
form = $("#ariaRequired"); | ||
test( "Data required field adds aria-required", function() { | ||
var ariaRequiredData = $( "#ariaRequiredData" ), | ||
form = $( "#ariaRequired" ); | ||
|
||
form.validate(); | ||
equal(ariaRequiredData.attr("aria-required"), "true"); | ||
}); | ||
equal( ariaRequiredData.attr( "aria-required" ), "true" ); | ||
} ); | ||
|
||
test("Class required field adds aria-required", function() { | ||
var ariaRequiredClass = $("#ariaRequiredClass"), | ||
form = $("#ariaRequired"); | ||
test( "Class required field adds aria-required", function() { | ||
var ariaRequiredClass = $( "#ariaRequiredClass" ), | ||
form = $( "#ariaRequired" ); | ||
|
||
form.validate(); | ||
equal(ariaRequiredClass.attr("aria-required"), "true"); | ||
}); | ||
equal( ariaRequiredClass.attr( "aria-required" ), "true" ); | ||
} ); | ||
|
||
test("Dynamically required field adds aria-required after valid()", function() { | ||
var ariaRequiredDynamic = $("#ariaRequiredDynamic"), | ||
form = $("#ariaRequired"); | ||
test( "Dynamically required field adds aria-required after valid()", function() { | ||
var ariaRequiredDynamic = $( "#ariaRequiredDynamic" ), | ||
form = $( "#ariaRequired" ); | ||
|
||
form.resetForm(); | ||
form.validate({ | ||
form.validate( { | ||
rules: { | ||
ariaRequiredDynamic: "required" | ||
} | ||
}); | ||
} ); | ||
ariaRequiredDynamic.valid(); | ||
equal(ariaRequiredDynamic.attr("aria-required"), "true"); | ||
}); | ||
equal( ariaRequiredDynamic.attr( "aria-required" ), "true" ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.