aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2013-09-30 20:23:21 +0400
committerOleg <markelog@gmail.com>2013-09-30 20:53:44 +0400
commit0a62e22579b67976a7d70002e493ee153d9496e8 (patch)
treedf1bdeba34ae58f9030a10d44a59a3f5df8ae7eb /test
parentf519539d3b7a12b67adc3b2c63a19e3beca33a83 (diff)
downloadjquery-0a62e22579b67976a7d70002e493ee153d9496e8.tar.gz
jquery-0a62e22579b67976a7d70002e493ee153d9496e8.zip
Focus on the body before running focus test
(cherry picked from commit b2f27632ebaa0f975eb70d531925129cee4014b9) Conflicts: test/unit/event.js
Diffstat (limited to 'test')
-rw-r--r--test/unit/event.js43
1 files changed, 21 insertions, 22 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index cbbde37a5..ce4536363 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -2567,35 +2567,34 @@ test( "make sure events cloned correctly", 18, function() {
clone.find("#check1").trigger("change"); // 0 events should fire
});
-// This test fails in some browsers if document does not have focus
-if ( !document.hasFocus || document.hasFocus && document.hasFocus() ) {
- test( "Check order of focusin/focusout events", 2, function() {
- var focus, blur,
- input = jQuery( "#name" );
+test( "Check order of focusin/focusout events", 2, function() {
+ var focus, blur,
+ input = jQuery( "#name" );
- input.on( "focus", function() {
- focus = true;
+ document.body.focus();
- }).on( "focusin", function() {
- ok( !focus, "Focusin event should fire before focus does" );
+ input.on( "focus", function() {
+ focus = true;
- }).on( "blur", function() {
- blur = true;
+ }).on( "focusin", function() {
+ ok( !focus, "Focusin event should fire before focus does" );
- }).on( "focusout", function() {
- ok( !blur, "Focusout event should fire before blur does" );
- });
+ }).on( "blur", function() {
+ blur = true;
- // gain focus
- input.trigger( "focus" );
+ }).on( "focusout", function() {
+ ok( !blur, "Focusout event should fire before blur does" );
+ });
- // then lose it
- jQuery( "#search" ).trigger( "focus" );
+ // gain focus
+ input.trigger( "focus" );
- // cleanup
- input.off();
- });
-}
+ // then lose it
+ jQuery( "#search" ).trigger( "focus" );
+
+ // cleanup
+ input.off();
+});
test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() {
expect( 1 );