@@ -10,7 +10,8 @@ module('data-disable-with', {
10
10
11
11
$ ( '#qunit-fixture' ) . append ( $ ( '<form />' , {
12
12
action : '/echo' ,
13
- method : 'post'
13
+ method : 'post' ,
14
+ id : 'not_remote'
14
15
} ) )
15
16
. find ( 'form:last' )
16
17
// WEEIRDD: the form won't submit to an iframe if the button is name="submit" (??!)
@@ -21,6 +22,15 @@ module('data-disable-with', {
21
22
href : '/echo' ,
22
23
'data-disable-with' : 'clicking...'
23
24
} ) ) ;
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
+ } ) ) ;
24
34
} ,
25
35
teardown : function ( ) {
26
36
$ ( document ) . unbind ( 'iframe:loaded' ) ;
@@ -110,6 +120,27 @@ asyncTest('form[data-remote] input[data-disable-with] is replaced with disabled
110
120
} ) . trigger ( 'submit' ) ;
111
121
} ) ;
112
122
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
+
113
144
asyncTest ( 'form[data-remote] textarea[data-disable-with] attribute' , 3 , function ( ) {
114
145
var form = $ ( 'form[data-remote]' ) ,
115
146
textarea = $ ( '<textarea data-disable-with="processing ..." name="user_bio">born, lived, died.</textarea>' ) . appendTo ( form ) ;
0 commit comments