mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-24 12:13:59 +01:00
committed by
Jörn Zaefferer
parent
4b33a75067
commit
c054707d6f
@@ -310,3 +310,24 @@ test( "test existing non-error aria-describedby", function( assert ) {
|
||||
strictEqual( "This is where you enter your data", $("#testForm17text-description").text() );
|
||||
strictEqual( "", $("#testForm17text-error").text(), "Error label is empty for valid field" );
|
||||
});
|
||||
|
||||
test( "test pre-assigned non-error aria-describedby", function( assert ) {
|
||||
expect( 7 );
|
||||
var form = $( "#testForm17" ),
|
||||
field = $( "#testForm17text" );
|
||||
|
||||
// Pre-assign error identifier
|
||||
field.attr( "aria-describedby", "testForm17text-description testForm17text-error" );
|
||||
form.validate({ errorElement: "span" });
|
||||
|
||||
ok( !field.valid() );
|
||||
equal( field.attr( "aria-describedby" ), "testForm17text-description testForm17text-error" );
|
||||
assert.hasError( field, "required" );
|
||||
|
||||
field.val( "foo" );
|
||||
ok( field.valid() );
|
||||
assert.noErrorFor( field );
|
||||
|
||||
strictEqual( "This is where you enter your data", $("#testForm17text-description").text() );
|
||||
strictEqual( "", $("#testForm17text-error").text(), "Error label is empty for valid field" );
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user