@@ -10,7 +10,8 @@ module('data-disable', {
1010
1111 $ ( '#qunit-fixture' ) . append ( $ ( '<form />' , {
1212 action : '/echo' ,
13- method : 'post'
13+ method : 'post' ,
14+ id : 'not_remote'
1415 } ) )
1516 . find ( 'form:last' )
1617 // WEEIRDD: the form won't submit to an iframe if the button is name="submit" (??!)
@@ -21,6 +22,14 @@ module('data-disable', {
2122 href : '/echo' ,
2223 'data-disable-with' : 'clicking...'
2324 } ) ) ;
25+
26+ $ ( '#qunit-fixture' ) . append ( $ ( '<input />' , {
27+ type : 'submit' ,
28+ form : 'not_remote' ,
29+ 'data-disable-with' : 'form attr submitting' ,
30+ name : 'submit3' ,
31+ value : 'Form Attr Submit'
32+ } ) ) ;
2433 } ,
2534 teardown : function ( ) {
2635 $ ( document ) . unbind ( 'iframe:loaded' ) ;
@@ -100,6 +109,27 @@ asyncTest('form input[type=submit][data-disable-with] disables', 6, function(){
100109 } , 30 ) ;
101110} ) ;
102111
112+ asyncTest ( 'form input[type=submit][data-disable-with] using "form" attribute disables' , 6 , function ( ) {
113+ var form = $ ( '#not_remote' ) , input = $ ( 'input[form=not_remote]' ) ;
114+ checkEnabledState ( input , 'Form Attr Submit' ) ;
115+
116+ // WEEIRDD: attaching this handler makes the test work in IE7
117+ $ ( document ) . bind ( 'iframe:loading' , function ( e , form ) { } ) ;
118+
119+ $ ( document ) . bind ( 'iframe:loaded' , function ( e , data ) {
120+ setTimeout ( function ( ) {
121+ checkDisabledState ( input , 'form attr submitting' ) ;
122+ start ( ) ;
123+ } , 30 ) ;
124+ } ) ;
125+ form . trigger ( 'submit' ) ;
126+
127+ setTimeout ( function ( ) {
128+ checkDisabledState ( input , 'form attr submitting' ) ;
129+ } , 30 ) ;
130+
131+ } ) ;
132+
103133asyncTest ( 'form[data-remote] input[type=submit][data-disable-with] is replaced in ajax callback' , 2 , function ( ) {
104134 var form = $ ( 'form:not([data-remote])' ) . attr ( 'data-remote' , 'true' ) , origFormContents = form . html ( ) ;
105135
0 commit comments