mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Tests: Try extra hard to control focus
Ref gh-3732
This commit is contained in:
parent
20cdf4e7de
commit
d9a099a58e
@ -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 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user