From 262acc6f1e0f71a3a8b786e3c421b2e645799ea0 Mon Sep 17 00:00:00 2001 From: Erik Lax Date: Thu, 23 Mar 2017 14:33:25 +0100 Subject: Ajax: add an ontimeout handler to all requests Fixes gh-3586 Close gh-3590 --- test/unit/ajax.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/unit/ajax.js') 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" ); -- cgit v1.2.3