Commit b2f27632 authored by Oleg's avatar Oleg

Focus on the body before running focus test

parent c809736d
...@@ -2644,6 +2644,8 @@ test( "Check order of focusin/focusout events", 2, function() { ...@@ -2644,6 +2644,8 @@ test( "Check order of focusin/focusout events", 2, function() {
var focus, blur, var focus, blur,
input = jQuery( "#name" ); input = jQuery( "#name" );
document.body.focus();
input.on( "focus", function() { input.on( "focus", function() {
focus = true; focus = true;
...@@ -2657,16 +2659,8 @@ test( "Check order of focusin/focusout events", 2, function() { ...@@ -2657,16 +2659,8 @@ test( "Check order of focusin/focusout events", 2, function() {
ok( !blur, "Focusout event should fire before blur does" ); ok( !blur, "Focusout event should fire before blur does" );
}); });
// This test fails in some browsers if document does not have focus // gain focus
if ( !document.hasFocus || document.hasFocus() ) { input.trigger( "focus" );
// gain focus
input.trigger( "focus" );
} else {
expect( 1 );
ok( true, "Document does not have focus - skipping" );
}
// then lose it // then lose it
jQuery( "#search" ).trigger( "focus" ); jQuery( "#search" ).trigger( "focus" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment