aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/ajax.js
diff options
context:
space:
mode:
authorBen Truyman <bentruyman@gmail.com>2012-10-16 11:37:15 -0400
committerRick Waldron <waldron.rick@gmail.com>2012-10-16 11:37:15 -0400
commitce5784a480ee6dc355fc961ab8bcd5828dabcbb6 (patch)
tree0ebf73c24d1e2736811b0f39b114fc1b8b1d8823 /test/unit/ajax.js
parentfcaef889682d6724f7b8e662c66a7539a95ae3d8 (diff)
downloadjquery-ce5784a480ee6dc355fc961ab8bcd5828dabcbb6.tar.gz
jquery-ce5784a480ee6dc355fc961ab8bcd5828dabcbb6.zip
Handle a falsy URL in the settings object for jQuery.ajax. Fixes #10093, Closes gh-979
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r--test/unit/ajax.js38
1 files changed, 36 insertions, 2 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index d11cb13f7..4a93c65fe 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -1451,7 +1451,7 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {
jQuery.each( [ "Same Domain", "Cross Domain" ], function( crossDomain, label ) {
-
+
asyncTest( "jQuery.ajax() - JSONP, Query String (?n)" + label, function() {
expect( 4 );
@@ -1543,7 +1543,7 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {
plus();
}
});
-
+
window["jsonpResults"] = function( data ) {
ok( data["data"], "JSON results returned (GET, custom callback function)" );
window["jsonpResults"] = undefined;
@@ -2725,4 +2725,38 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {
expect( 1 );
ok( jQuery.active === 0, "ajax active counter should be zero: " + jQuery.active );
});
+
+ test("jQuery.ajax - falsy url as argument (#10093)", function() {
+ expect( 4 );
+
+ jQuery.ajaxSetup({ timeout: 0 });
+
+ stop();
+
+ jQuery.when(
+ jQuery.ajax("").success(function(){ ok( true, "settings object - empty string" ); }),
+ jQuery.ajax( false ).success(function(){ ok( true, "false" ); }),
+ jQuery.ajax( null ).success(function(){ ok( true, "null" ); }),
+ jQuery.ajax( undefined ).success(function(){ ok( true, "undefined" ); })
+ ).always(function () {
+ start();
+ });
+ });
+
+ test("jQuery.ajax - falsy url in settings object (#10093)", function() {
+ expect( 4 );
+
+ jQuery.ajaxSetup({ timeout: 0 });
+
+ stop();
+
+ jQuery.when(
+ jQuery.ajax({ url: "" }).success(function(){ ok( true, "settings object - empty string" ); }),
+ jQuery.ajax({ url: false }).success(function(){ ok( true, "false" ); }),
+ jQuery.ajax({ url: null }).success(function(){ ok( true, "null" ); }),
+ jQuery.ajax({ url: undefined }).success(function(){ ok( true, "undefined" ); })
+ ).always(function () {
+ start();
+ });
+ });
}