@@ -47,6 +47,34 @@ asyncTest('modifying form fields with "ajax:before" sends modified data in reque
4747 } ) ;
4848} ) ;
4949
50+ asyncTest ( 'modifying data("type") with "ajax:before" requests new dataType in request' , 2 , function ( ) {
51+ $ ( 'form[data-remote]' ) . data ( 'type' , 'html' )
52+ . live ( 'ajax:before' , function ( ) {
53+ var form = $ ( this ) ;
54+ form . data ( 'type' , 'xml' )
55+ } ) ;
56+
57+ submit ( function ( form ) {
58+ form . bind ( 'ajax:beforeSend' , function ( e , xhr , settings ) {
59+ equal ( settings . dataType , 'xml' , 'modified dataType should have been requested' ) ;
60+ } ) ;
61+ } ) ;
62+ } ) ;
63+
64+ asyncTest ( 'setting data("cross-domain",true) with "ajax:before" uses new setting in request' , 2 , function ( ) {
65+ $ ( 'form[data-remote]' ) . data ( 'cross-domain' , false )
66+ . live ( 'ajax:before' , function ( ) {
67+ var form = $ ( this ) ;
68+ form . data ( 'cross-domain' , true )
69+ } ) ;
70+
71+ submit ( function ( form ) {
72+ form . bind ( 'ajax:beforeSend' , function ( e , xhr , settings ) {
73+ equal ( settings . crossDomain , true , 'setting modified in ajax:before should have forced cross-domain request' ) ;
74+ } ) ;
75+ } ) ;
76+ } ) ;
77+
5078asyncTest ( 'stopping the "ajax:beforeSend" event aborts the request' , 1 , function ( ) {
5179 submit ( function ( form ) {
5280 form . bind ( 'ajax:beforeSend' , function ( ) {
0 commit comments