aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/ajax.js
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2012-11-29 00:15:17 +0100
committerjaubourg <j@ubourg.net>2012-11-29 00:15:17 +0100
commit6378a19c46421d20a26e6b3a3c21caf0ea2fedfa (patch)
treebc28eb30728876ae0b4bb0998f8939ced3b74a59 /test/unit/ajax.js
parent081c4efcf7736433d2fb5702e7bd4f8616426af2 (diff)
downloadjquery-6378a19c46421d20a26e6b3a3c21caf0ea2fedfa.tar.gz
jquery-6378a19c46421d20a26e6b3a3c21caf0ea2fedfa.zip
Unit test for #12004
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r--test/unit/ajax.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index e6da04519..ffc4549ff 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -1521,6 +1521,40 @@ module( "ajax", {
}, "exception bubbled" );
});
+ jQuery.each( [ "method", "type" ], function( _, globalOption ) {
+
+ function request( option ) {
+ var options = {
+ url: url("data/echoData.php"),
+ data: "hello",
+ success: function( msg ) {
+ strictEqual( msg, "hello", "Check for POST (no override)" );
+ }
+ };
+ if ( option ) {
+ options[ option ] = "GET";
+ options.success = function( msg ) {
+ strictEqual( msg, "", "Check for no POST (overriding with " + option + ")" );
+ };
+ }
+ return options;
+ }
+
+ ajaxTest( "#12004 - jQuery.ajax() - method is an alias of type - " + globalOption + " set globally", 3, {
+ setup: function() {
+ var options = {};
+ options[ globalOption ] = "POST";
+ jQuery.ajaxSetup( options );
+ },
+ requests: [
+ request("type"),
+ request("method"),
+ request()
+ ]
+ });
+
+ });
+
//----------- jQuery.ajaxPrefilter()
ajaxTest( "jQuery.ajaxPrefilter() - abort", 1, {