mirror of
https://github.com/jquery/jquery.git
synced 2026-02-16 16:36:07 -05:00
Ajax: trigger error callback on native abort
- IE9 does not have onabort. Use onreadystatechange instead. Fixes gh-2079 Close gh-2684
This commit is contained in:
@@ -38,7 +38,7 @@ QUnit.module( "ajax", {
|
||||
);
|
||||
|
||||
ajaxTest( "jQuery.ajax() - success callbacks", 8, function( assert ) {
|
||||
return {
|
||||
return {
|
||||
setup: addGlobalEvents( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess", assert ),
|
||||
url: url( "data/name.html" ),
|
||||
beforeSend: function() {
|
||||
@@ -437,6 +437,25 @@ QUnit.module( "ajax", {
|
||||
};
|
||||
} );
|
||||
|
||||
ajaxTest( "jQuery.ajax() - native abort", 2, function( assert ) {
|
||||
return {
|
||||
url: url( "data/name.php?wait=1" ),
|
||||
xhr: function() {
|
||||
var xhr = new window.XMLHttpRequest();
|
||||
setTimeout( function() {
|
||||
xhr.abort();
|
||||
}, 100 );
|
||||
return xhr;
|
||||
},
|
||||
error: function( xhr, msg ) {
|
||||
assert.strictEqual( msg, "error", "Native abort triggers error callback" );
|
||||
},
|
||||
complete: function() {
|
||||
assert.ok( true, "complete" );
|
||||
}
|
||||
};
|
||||
} );
|
||||
|
||||
ajaxTest( "jQuery.ajax() - events with context", 12, function( assert ) {
|
||||
var context = document.createElement( "div" );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user