X-Git-Url: http://git.asbjorn.biz/?p=jquery.git;a=blobdiff_plain;f=test%2Funit%2Fajax.js;fp=test%2Funit%2Fajax.js;h=57e65124d9a59bb56be4921bd2bc2d7f8202c825;hp=b81031384d455fa766404c2db60ba467e4741787;hb=03bad0a9600f05e61a1464c55354d26fcd8f97a4;hpb=d66cc553167c6b00d19aa62a4dd1e9affb20d395 diff --git a/test/unit/ajax.js b/test/unit/ajax.js index b810313..57e6512 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -2177,6 +2177,25 @@ test("jQuery.ajax - transitive conversions", function() { }); +test("jQuery.ajax - abort in prefilter", function() { + + expect( 1 ); + + jQuery.ajaxPrefilter(function( options, _, jqXHR ) { + if ( options.abortInPrefilter ) { + jqXHR.abort(); + } + }); + + strictEqual( jQuery.ajax({ + abortInPrefilter: true, + error: function() { + ok( false, "error callback called" ); + } + }), false, "Request was properly aborted early by the prefilter" ); + +}); + test("jQuery.ajax - active counter", function() { ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active ); });