From 6378a19c46421d20a26e6b3a3c21caf0ea2fedfa Mon Sep 17 00:00:00 2001 From: jaubourg Date: Thu, 29 Nov 2012 00:15:17 +0100 Subject: [PATCH] Unit test for #12004 --- test/unit/ajax.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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, { -- 2.39.5