diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2017-07-18 20:49:47 -0400 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2017-07-18 20:49:47 -0400 |
commit | 03db56a7e3250ee4a6271ac1b0c2c4053d2999c9 (patch) | |
tree | 855bcb6dedf1e4fa97c7ea6d6bc2ddbb6629f68f | |
parent | d9a099a58e1bb1f158ea66ec55534770be442907 (diff) | |
download | jquery-03db56a7e3250ee4a6271ac1b0c2c4053d2999c9.tar.gz jquery-03db56a7e3250ee4a6271ac1b0c2c4053d2999c9.zip |
Tests: Abort focus tests when the environment doesn't cooperate
Ref gh-3732
-rw-r--r-- | test/unit/event.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/unit/event.js b/test/unit/event.js index f1bf3bfa1..8a8a5589e 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2811,11 +2811,20 @@ QUnit.test( "preventDefault() on focusin does not throw exception", function( as done = null; } ); - // This test can be flaky in CI... try two methods to prompt a focusin event + // This test can be unreliable in CI... try two methods to prompt a focusin event + // and set an abort timeout input.trigger( "focus" ); try { input[ 0 ].focus(); } catch ( e ) {} + setTimeout( function() { + if ( !done ) { + return; + } + assert.ok( true, "Did not intercept focusin" ); + done(); + done = null; + }, QUnit.config.testTimeout / 2 || 1000 ); } ); QUnit.test( "Donor event interference", function( assert ) { |