aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2013-09-23 20:50:31 +0400
committerOleg <markelog@gmail.com>2013-09-23 20:50:31 +0400
commit0b9a182ecde49adb508d76577e8f244da08a1e51 (patch)
tree600955322a863c59fcaf155b2fd57281da0da4e6 /test/unit
parent3d6ed4483e2c9c52d83bdab72e9b884ebf720f22 (diff)
downloadjquery-0b9a182ecde49adb508d76577e8f244da08a1e51.tar.gz
jquery-0b9a182ecde49adb508d76577e8f244da08a1e51.zip
Run focus test only if document has focus
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/event.js42
1 files changed, 21 insertions, 21 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index c48a4d9ae..976e407df 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -2640,35 +2640,35 @@ test( "make sure events cloned correctly", 18, function() {
clone.find("#check1").trigger("change"); // 0 events should fire
});
-asyncTest( "Check order of focusin/focusout events", 2, function() {
- var focus, blur,
- input = jQuery("#name");
+// 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" );
- input.on("focus", function() {
- focus = true;
+ input.on( "focus", function() {
+ focus = true;
- }).on("focusin", function() {
- ok( !focus, "Focusin event should fire before focus does" );
+ }).on( "focusin", function() {
+ ok( !focus, "Focusin event should fire before focus does" );
- }).on("blur", function() {
- blur = true;
+ }).on( "blur", function() {
+ blur = true;
- }).on("focusout", function() {
- ok( !blur, "Focusout event should fire before blur does" );
- });
+ }).on( "focusout", function() {
+ ok( !blur, "Focusout event should fire before blur does" );
+ });
- // gain focus
- input.trigger("focus");
+ // gain focus
+ input.trigger( "focus" );
- // then lose it
- jQuery("#search").trigger("focus");
+ // then lose it
+ jQuery( "#search" ).trigger( "focus" );
- // cleanup
- setTimeout(function() {
+ // cleanup
input.off();
- start();
- }, 50 );
-});
+ });
+}
test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() {
expect( 1 );