]> source.dussan.org Git - jquery.git/commitdiff
Focus on the body before running focus test
authorOleg <markelog@gmail.com>
Mon, 30 Sep 2013 16:23:21 +0000 (20:23 +0400)
committerOleg <markelog@gmail.com>
Mon, 30 Sep 2013 16:23:21 +0000 (20:23 +0400)
test/unit/event.js

index b6b9fe21697bfda7bc9d67e231126c4fc80860b8..db4f9d0a82e11e670ebe088ebf89d473496a13e3 100644 (file)
@@ -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" );