X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fajax.js;h=4ce14c24cf6bd3d046f8e287d440f667b6cce3bc;hb=b50f41a2e3ba9ab9a7bcf69a9633b0a8258015d6;hp=5704d73e0deddbb912e51d8988fe9b01b0462455;hpb=ec462a33af41e9a2291599119e3ae74fc16e6a32;p=jquery.git diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 5704d73..4ce14c2 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() { @@ -289,6 +292,32 @@ test("jQuery.ajax - xml: non-namespace elements inside namespaced elements", fun }); }); +test("jQuery.ajax - HEAD requests", function() { + expect(2); + + stop(); + jQuery.ajax({ + url: url("data/name.html"), + type: "HEAD", + success: function(data, status, xhr){ + var h = xhr.getAllResponseHeaders(); + ok( /Date/i.test(h), 'No Date in HEAD response' ); + + jQuery.ajax({ + url: url("data/name.html"), + data: { whip_it: "good" }, + type: "HEAD", + success: function(data, status, xhr){ + var h = xhr.getAllResponseHeaders(); + ok( /Date/i.test(h), 'No Date in HEAD response with data' ); + start(); + } + }); + } + }); + +}); + test("jQuery.ajax - beforeSend", function() { expect(1); stop();