From 03db56a7e3250ee4a6271ac1b0c2c4053d2999c9 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Tue, 18 Jul 2017 20:49:47 -0400 Subject: [PATCH] Tests: Abort focus tests when the environment doesn't cooperate Ref gh-3732 --- test/unit/event.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 ) { -- 2.39.5