@@ -32,6 +32,19 @@ asyncTest('form method is not read from "data-method" attribute in case of missi
32
32
} ) ;
33
33
} ) ;
34
34
35
+ asyncTest ( 'form method is read from submit button "formmethod" if submit is triggered by that button' , 1 , function ( ) {
36
+ var submitButton = $ ( '<input type="submit" formmethod="get">' )
37
+ buildForm ( { method : 'post' } ) ;
38
+
39
+ $ ( '#qunit-fixture' ) . find ( 'form' ) . append ( submitButton )
40
+ . bind ( 'ajax:success' , function ( e , data , status , xhr ) {
41
+ App . assertGetRequest ( data ) ;
42
+ } )
43
+ . bind ( 'ajax:complete' , function ( ) { start ( ) } ) ;
44
+
45
+ submitButton . trigger ( 'click' ) ;
46
+ } ) ;
47
+
35
48
asyncTest ( 'form default method is GET' , 1 , function ( ) {
36
49
buildForm ( ) ;
37
50
@@ -56,6 +69,19 @@ asyncTest('form url is read from "action" not "href"', 1, function() {
56
69
} ) ;
57
70
} ) ;
58
71
72
+ asyncTest ( 'form url is read from submit button "formaction" if submit is triggered by that button' , 1 , function ( ) {
73
+ var submitButton = $ ( '<input type="submit" formaction="/echo">' )
74
+ buildForm ( { method : 'post' , href : '/echo2' } ) ;
75
+
76
+ $ ( '#qunit-fixture' ) . find ( 'form' ) . append ( submitButton )
77
+ . bind ( 'ajax:success' , function ( e , data , status , xhr ) {
78
+ App . assertRequestPath ( data , '/echo' ) ;
79
+ } )
80
+ . bind ( 'ajax:complete' , function ( ) { start ( ) } ) ;
81
+
82
+ submitButton . trigger ( 'click' ) ;
83
+ } ) ;
84
+
59
85
asyncTest ( 'prefer JS, but accept any format' , 1 , function ( ) {
60
86
buildForm ( { method : 'post' } ) ;
61
87
0 commit comments