diff options
author | jaubourg <j@ubourg.net> | 2012-08-16 16:45:18 +0200 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2012-08-16 16:45:18 +0200 |
commit | b292c4c2df673d17d8c720e13d4d81ecae4ec499 (patch) | |
tree | 72a70205b7d98a3716e45255beecd792070456ac /test/unit/ajax.js | |
parent | aa1350d9e29571a82d09bb7a2eac4396901daa77 (diff) | |
download | jquery-b292c4c2df673d17d8c720e13d4d81ecae4ec499.tar.gz jquery-b292c4c2df673d17d8c720e13d4d81ecae4ec499.zip |
Calling load with null as the data parameter now properly issues a GET request, not a POST request. Unit tests added. Fixes #12234.
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r-- | test/unit/ajax.js | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 2371f8982..1345eae3a 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -1037,11 +1037,45 @@ test("global ajaxSettings", function() { */ test("load(String)", function() { - expect(1); + expect(2); stop(); // check if load can be called with only url + jQuery.ajaxSetup({ + beforeSend: function() { + strictEqual( this.type, "GET", "no data means GET request" ); + } + }); jQuery("#first").load("data/name.html", function() { start(); }); + jQuery.ajaxSetup({ + beforeSend: null + }); +}); + +test("load(String,null)", function() { + expect(2); + stop(); // check if load can be called with url and null data + jQuery.ajaxSetup({ + beforeSend: function() { + strictEqual( this.type, "GET", "no data means GET request" ); + } + }); + jQuery("#first").load("data/name.html", null, function() { + start(); + }); +}); + +test("load(String,undefined)", function() { + expect(2); + stop(); // check if load can be called with url and null data + jQuery.ajaxSetup({ + beforeSend: function() { + strictEqual( this.type, "GET", "no data means GET request" ); + } + }); + jQuery("#first").load("data/name.html", undefined, function() { + start(); + }); }); test("load('url selector')", function() { |