@@ -10,7 +10,8 @@ module('data-disable-with', {
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,15 @@ module('data-disable-with', {
2122 href : '/echo' ,
2223 'data-disable-with' : 'clicking...'
2324 } ) ) ;
25+
26+
27+ $ ( '#qunit-fixture' ) . append ( $ ( '<input />' , {
28+ type : 'submit' ,
29+ form : 'not_remote' ,
30+ 'data-disable-with' : 'form attr submitting' ,
31+ name : 'submit3' ,
32+ value : 'Form Attr Submit'
33+ } ) ) ;
2434 } ,
2535 teardown : function ( ) {
2636 $ ( document ) . unbind ( 'iframe:loaded' ) ;
@@ -110,6 +120,27 @@ asyncTest('form[data-remote] input[data-disable-with] is replaced with disabled
110120 } ) . trigger ( 'submit' ) ;
111121} ) ;
112122
123+ asyncTest ( 'form input[type=submit][data-disable-with] using "form" attribute disables' , 6 , function ( ) {
124+ var form = $ ( '#not_remote' ) , input = $ ( 'input[form=not_remote]' ) ;
125+ App . checkEnabledState ( input , 'Form Attr Submit' ) ;
126+
127+ // WEEIRDD: attaching this handler makes the test work in IE7
128+ $ ( document ) . bind ( 'iframe:loading' , function ( e , form ) { } ) ;
129+
130+ $ ( document ) . bind ( 'iframe:loaded' , function ( e , data ) {
131+ setTimeout ( function ( ) {
132+ App . checkDisabledState ( input , 'form attr submitting' ) ;
133+ start ( ) ;
134+ } , 30 ) ;
135+ } ) ;
136+ form . trigger ( 'submit' ) ;
137+
138+ setTimeout ( function ( ) {
139+ App . checkDisabledState ( input , 'form attr submitting' ) ;
140+ } , 30 ) ;
141+
142+ } ) ;
143+
113144asyncTest ( 'form[data-remote] textarea[data-disable-with] attribute' , 3 , function ( ) {
114145 var form = $ ( 'form[data-remote]' ) ,
115146 textarea = $ ( '<textarea data-disable-with="processing ..." name="user_bio">born, lived, died.</textarea>' ) . appendTo ( form ) ;
0 commit comments