@@ -10,7 +10,8 @@ module('data-disable', {
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,14 @@ module('data-disable', {
21
22
href : '/echo' ,
22
23
'data-disable-with' : 'clicking...'
23
24
} ) ) ;
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
+ } ) ) ;
24
33
} ,
25
34
teardown : function ( ) {
26
35
$ ( document ) . unbind ( 'iframe:loaded' ) ;
@@ -100,6 +109,27 @@ asyncTest('form input[type=submit][data-disable-with] disables', 6, function(){
100
109
} , 30 ) ;
101
110
} ) ;
102
111
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
+
103
133
asyncTest ( 'form[data-remote] input[type=submit][data-disable-with] is replaced in ajax callback' , 2 , function ( ) {
104
134
var form = $ ( 'form:not([data-remote])' ) . attr ( 'data-remote' , 'true' ) , origFormContents = form . html ( ) ;
105
135
0 commit comments