Commit c809736d authored by Oleg's avatar Oleg

Try to fix focus test again

parent b31bd4c0
...@@ -2640,35 +2640,40 @@ test( "make sure events cloned correctly", 18, function() { ...@@ -2640,35 +2640,40 @@ test( "make sure events cloned correctly", 18, function() {
clone.find("#check1").trigger("change"); // 0 events should fire clone.find("#check1").trigger("change"); // 0 events should fire
}); });
// This test fails in some browsers if document does not have focus test( "Check order of focusin/focusout events", 2, function() {
if ( !document.hasFocus || document.hasFocus && document.hasFocus() ) { var focus, blur,
test( "Check order of focusin/focusout events", 2, function() { input = jQuery( "#name" );
var focus, blur,
input = jQuery( "#name" );
input.on( "focus", function() { input.on( "focus", function() {
focus = true; focus = true;
}).on( "focusin", function() { }).on( "focusin", function() {
ok( !focus, "Focusin event should fire before focus does" ); ok( !focus, "Focusin event should fire before focus does" );
}).on( "blur", function() { }).on( "blur", function() {
blur = true; blur = true;
}).on( "focusout", function() { }).on( "focusout", 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
if ( !document.hasFocus || document.hasFocus() ) {
// gain focus // gain focus
input.trigger( "focus" ); input.trigger( "focus" );
// then lose it } else {
jQuery( "#search" ).trigger( "focus" ); expect( 1 );
ok( true, "Document does not have focus - skipping" );
}
// then lose it
jQuery( "#search" ).trigger( "focus" );
// cleanup // cleanup
input.off(); input.off();
}); });
}
test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() { test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() {
expect( 1 ); expect( 1 );
......
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