aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/ajax.js
diff options
context:
space:
mode:
authorErik Lax <erik@datahack.se>2017-03-23 14:33:25 +0100
committerTimmy Willison <4timmywil@gmail.com>2017-07-24 11:44:09 -0400
commit262acc6f1e0f71a3a8b786e3c421b2e645799ea0 (patch)
treed6b57361c556b2a13e73454b746733ae2795ece4 /test/unit/ajax.js
parentd65bdd5fc8edf390211ed2223a03c6a00a41c649 (diff)
downloadjquery-262acc6f1e0f71a3a8b786e3c421b2e645799ea0.tar.gz
jquery-262acc6f1e0f71a3a8b786e3c421b2e645799ea0.zip
Ajax: add an ontimeout handler to all requests
Fixes gh-3586 Close gh-3590
Diffstat (limited to 'test/unit/ajax.js')
-rw-r--r--test/unit/ajax.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 07ff40783..4dc7b9d3a 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -527,6 +527,23 @@ QUnit.module( "ajax", {
};
} );
+ ajaxTest( "jQuery.ajax() - native timeout", 2, function( assert ) {
+ return {
+ url: url( "data/name.php?wait=1" ),
+ xhr: function() {
+ var xhr = new window.XMLHttpRequest();
+ xhr.timeout = 1;
+ return xhr;
+ },
+ error: function( xhr, msg ) {
+ assert.strictEqual( msg, "error", "Native timeout triggers error callback" );
+ },
+ complete: function() {
+ assert.ok( true, "complete" );
+ }
+ };
+ } );
+
ajaxTest( "jQuery.ajax() - events with context", 12, function( assert ) {
var context = document.createElement( "div" );