aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimmy Willison <4timmywil@gmail.com>2018-01-03 11:39:19 -0500
committerTimmy Willison <4timmywil@gmail.com>2018-01-08 11:46:43 -0500
commite2f192887cb03400128b975c8cd86d6c4dc1e31e (patch)
tree177efbdb3db1d3a4b1a4ff00ce0acf9d5ad177d6
parent7be448d41fa124474aeee8423d57df11073791fd (diff)
downloadjquery-e2f192887cb03400128b975c8cd86d6c4dc1e31e.tar.gz
jquery-e2f192887cb03400128b975c8cd86d6c4dc1e31e.zip
Tests: only run ontimeout test if ontimeout exists
Fixes gh-3742 Close gh-3919
-rw-r--r--test/unit/ajax.js36
1 files changed, 20 insertions, 16 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index b84ce4872..26aa3ad21 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -524,22 +524,26 @@ QUnit.module( "ajax", {
};
} );
- ajaxTest( "jQuery.ajax() - native timeout", 2, function( assert ) {
- return {
- url: url( "mock.php?action=wait&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" );
- }
- };
- } );
+ // Support: Android <= 4.0 - 4.3 only
+ // Android 4.0-4.3 does not have ontimeout on an xhr
+ if ( "ontimeout" in new window.XMLHttpRequest() ) {
+ ajaxTest( "jQuery.ajax() - native timeout", 2, function( assert ) {
+ return {
+ url: url( "mock.php?action=wait&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" );