File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -423,7 +423,10 @@ $.extend($.validator, {
423423 this . lastElement = null ;
424424 this . prepareForm ( ) ;
425425 this . hideErrors ( ) ;
426- this . elements ( ) . removeClass ( this . settings . errorClass ) . removeData ( "previousValue" ) ;
426+ this . elements ( )
427+ . removeClass ( this . settings . errorClass )
428+ . removeData ( "previousValue" )
429+ . removeAttr ( "aria-invalid" ) ;
427430 } ,
428431
429432 numberOfInvalids : function ( ) {
Original file line number Diff line number Diff line change 11module ( "aria" ) ;
2-
2+
33test ( "Invalid field adds aria-invalid=true" , function ( ) {
44 var ariafirstname = $ ( '#ariafirstname' ) ;
55 var form = $ ( '#ariaInvalid' ) ;
@@ -24,4 +24,19 @@ test("Valid field adds aria-invalid=false", function() {
2424 ariafirstname . val ( 'not empty' ) ;
2525 ariafirstname . valid ( ) ;
2626 equal ( ariafirstname . attr ( "aria-invalid" ) , "false" ) ;
27+ equal ( $ ( "#ariaInvalid [aria-invalid=false]" ) . length , 1 ) ;
28+ } ) ;
29+
30+ test ( "resetForm(): removes all aria-invalid attributes" , function ( ) {
31+ var ariafirstname = $ ( '#ariafirstname' ) ;
32+ var form = $ ( "#ariaInvalid" ) ;
33+ var validator = form . validate ( {
34+ rules : {
35+ ariafirstname : "required"
36+ }
37+ } ) ;
38+ ariafirstname . val ( 'not empty' ) ;
39+ ariafirstname . valid ( ) ;
40+ validator . resetForm ( ) ;
41+ equal ( $ ( "#ariaInvalid [aria-invalid]" ) . length , 0 , "resetForm() should remove any aria-invalid attributes" ) ;
2742} ) ;
You can’t perform that action at this time.
0 commit comments