@@ -32,6 +32,19 @@ asyncTest('form method is not read from "data-method" attribute in case of missi
3232 } ) ;
3333} ) ;
3434
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+
3548asyncTest ( 'form default method is GET' , 1 , function ( ) {
3649 buildForm ( ) ;
3750
@@ -56,6 +69,19 @@ asyncTest('form url is read from "action" not "href"', 1, function() {
5669 } ) ;
5770} ) ;
5871
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+
5985asyncTest ( 'prefer JS, but accept any format' , 1 , function ( ) {
6086 buildForm ( { method : 'post' } ) ;
6187
0 commit comments