Tests: Try extra hard to control focus

Ref gh-3732
This commit is contained in:
Richard Gibson 2017-07-18 20:32:01 -04:00
parent 20cdf4e7de
commit d9a099a58e

View File

@ -2792,10 +2792,12 @@ QUnit.test( "preventDefault() on focusin does not throw exception", function( as
var done = assert.async(),
input = jQuery( "<input/>" ).appendTo( "#form" );
input
.on( "focusin", function( event ) {
var exceptionCaught;
input.on( "focusin", function( event ) {
if ( !done ) {
return;
}
var exceptionCaught;
try {
event.preventDefault();
} catch ( theException ) {
@ -2806,7 +2808,14 @@ QUnit.test( "preventDefault() on focusin does not throw exception", function( as
"Preventing default on focusin throws no exception" );
done();
} ).trigger( "focus" );
done = null;
} );
// This test can be flaky in CI... try two methods to prompt a focusin event
input.trigger( "focus" );
try {
input[ 0 ].focus();
} catch ( e ) {}
} );
QUnit.test( "Donor event interference", function( assert ) {