diff options
author | jaubourg <j@ubourg.net> | 2011-02-04 22:19:23 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-02-04 22:19:23 +0100 |
commit | 03bad0a9600f05e61a1464c55354d26fcd8f97a4 (patch) | |
tree | 64165e2fdda68333db88a873ddc09cc2cc36afea /test/unit/ajax.js | |
parent | d66cc553167c6b00d19aa62a4dd1e9affb20d395 (diff) | |
download | jquery-03bad0a9600f05e61a1464c55354d26fcd8f97a4.tar.gz jquery-03bad0a9600f05e61a1464c55354d26fcd8f97a4.zip |
Fixes abort in prefilter. No global event will be fired in that case even if the global option is set to true. Unit test added.
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r-- | test/unit/ajax.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index b81031384..57e65124d 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 ); }); |