Skip to content

Commit 03db56a

Browse files
committed
Tests: Abort focus tests when the environment doesn't cooperate
Ref jquerygh-3732
1 parent d9a099a commit 03db56a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/unit/event.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2811,11 +2811,20 @@ QUnit.test( "preventDefault() on focusin does not throw exception", function( as
28112811
done = null;
28122812
} );
28132813

2814-
// This test can be flaky in CI... try two methods to prompt a focusin event
2814+
// This test can be unreliable in CI... try two methods to prompt a focusin event
2815+
// and set an abort timeout
28152816
input.trigger( "focus" );
28162817
try {
28172818
input[ 0 ].focus();
28182819
} catch ( e ) {}
2820+
setTimeout( function() {
2821+
if ( !done ) {
2822+
return;
2823+
}
2824+
assert.ok( true, "Did not intercept focusin" );
2825+
done();
2826+
done = null;
2827+
}, QUnit.config.testTimeout / 2 || 1000 );
28192828
} );
28202829

28212830
QUnit.test( "Donor event interference", function( assert ) {

0 commit comments

Comments
 (0)