diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2015-11-02 12:00:28 -0500 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2015-11-03 12:34:04 -0500 |
commit | 76e9a95dbeaf28fbc5a64571ebb5959f91a9c14a (patch) | |
tree | da3d2a0b211ca3c30677a3116bc7dcad896cc2d9 /test/unit | |
parent | 70605c8e5655da996ebd395e3c43423daaa08d9c (diff) | |
download | jquery-76e9a95dbeaf28fbc5a64571ebb5959f91a9c14a.tar.gz jquery-76e9a95dbeaf28fbc5a64571ebb5959f91a9c14a.zip |
Ajax: trigger error callback on native abort
- IE9 does not have onabort. Use onreadystatechange instead.
Fixes gh-2079
Close gh-2684
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/ajax.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 7710f9e35..4f0530656 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -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" ); |