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.
This commit is contained in:
parent
d66cc55316
commit
03bad0a960
2 changed files with 33 additions and 4 deletions
|
@ -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 );
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue