X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fajax.js;h=a0f3d49f2d4c5b4031eab9bde53fd138426b9779;hb=796d25cf07ad63e2008ff4b70db182d33a3533dd;hp=734465916bd07252be7b34df64ceaa48bc013403;hpb=09022e0b09db71259751e7146bb64727615028af;p=jquery.git diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 7344659..a0f3d49 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -137,7 +137,7 @@ test(".load()) - 404 error callbacks", function() { }); test("jQuery.ajax() - abort", function() { - expect( 6 ); + expect( 8 ); stop(); jQuery('#foo').ajaxStart(function(){ @@ -157,7 +157,10 @@ test("jQuery.ajax() - abort", function() { complete: function(){ ok(true, "complete"); } }); + equals( xhr.readyState, 1, "XHR readyState indicates successful dispatch" ); + xhr.abort(); + equals( xhr.readyState, 0, "XHR readyState indicates successful abortion" ); }); test("Ajax events with context", function() { @@ -707,10 +710,10 @@ test("jQuery.getScript(String, Function) - no callback", function() { }); test("jQuery.ajax() - JSONP, Local", function() { - expect(8); + expect(9); var count = 0; - function plus(){ if ( ++count == 8 ) start(); } + function plus(){ if ( ++count == 9 ) start(); } stop(); @@ -825,21 +828,17 @@ test("jQuery.ajax() - JSONP, Local", function() { plus(); } }); - - // Supports Ticket #5803 + + //#7578 jQuery.ajax({ url: "data/jsonp.php", - jsonpCallback: "jsonpResults", - success: function(data){ - ok( data.data, "JSON results returned without dataType:jsonp when jsonpCallback is defined" ); - plus(); - }, - error: function(data){ - ok( false, "Ajax error JSON (GET, custom callback name)" ); + dataType: "jsonp", + beforeSend: function(){ + strictEqual( this.cache, false, "cache must be false on JSON request" ); plus(); + return false; } - }); - + }); }); test("JSONP - Custom JSONP Callback", function() { @@ -1362,6 +1361,16 @@ test("jQuery.ajax - active counter", function() { ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active ); }); +test( "jQuery.ajax - Location object as url (#7531)", 1, function () { + var success = false; + try { + var xhr = jQuery.ajax({ url: document.location }); + success = true; + xhr.abort(); + } catch (e) {} + + ok( success, "document.location did not generate exception" ); +}); }