Permalink
Browse files

Unit test for #12004

  • Loading branch information...
1 parent 081c4ef commit 6378a19c46421d20a26e6b3a3c21caf0ea2fedfa @jaubourg jaubourg committed Nov 28, 2012
Showing with 34 additions and 0 deletions.
  1. +34 −0 test/unit/ajax.js
View
34 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, {

0 comments on commit 6378a19

Please sign in to comment.