From: Oleg Date: Mon, 30 Sep 2013 16:23:21 +0000 (+0400) Subject: Focus on the body before running focus test X-Git-Tag: 1.11.0-beta2~73 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b2f27632ebaa0f975eb70d531925129cee4014b9;p=jquery.git Focus on the body before running focus test --- diff --git a/test/unit/event.js b/test/unit/event.js index b6b9fe216..db4f9d0a8 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2644,6 +2644,8 @@ test( "Check order of focusin/focusout events", 2, function() { var focus, blur, input = jQuery( "#name" ); + document.body.focus(); + input.on( "focus", function() { focus = true; @@ -2657,16 +2659,8 @@ test( "Check order of focusin/focusout events", 2, function() { ok( !blur, "Focusout event should fire before blur does" ); }); - // This test fails in some browsers if document does not have focus - if ( !document.hasFocus || document.hasFocus() ) { - - // gain focus - input.trigger( "focus" ); - - } else { - expect( 1 ); - ok( true, "Document does not have focus - skipping" ); - } + // gain focus + input.trigger( "focus" ); // then lose it jQuery( "#search" ).trigger( "focus" );