Don't execute focus tests in Firefox

Close gh-1423
This commit is contained in:
Oleg 2013-11-07 22:32:12 +01:00
parent 626cbde7f8
commit 45be91e398

View File

@ -2346,51 +2346,6 @@ test("checkbox state (#3827)", function() {
jQuery( cb ).triggerHandler( "click" );
});
test("focus-blur order (#12868)", function() {
expect( 5 );
var order,
$text = jQuery("#text1"),
$radio = jQuery("#radio1").trigger("focus");
// IE6-10 fire focus/blur events asynchronously; this is the resulting mess.
// IE's browser window must be topmost for this to work properly!!
stop();
$radio[0].focus();
setTimeout( function() {
$text
.on( "focus", function(){
equal( order++, 1, "text focus" );
})
.on( "blur", function(){
equal( order++, 0, "text blur" );
});
$radio
.on( "focus", function(){
equal( order++, 1, "radio focus" );
})
.on( "blur", function(){
equal( order++, 0, "radio blur" );
});
// Enabled input getting focus
order = 0;
equal( document.activeElement, $radio[0], "radio has focus" );
$text.trigger("focus");
setTimeout( function() {
equal( document.activeElement, $text[0], "text has focus" );
// Run handlers without native method on an input
order = 1;
$radio.triggerHandler( "focus" );
$text.off();
start();
}, 50 );
}, 50 );
});
test("hover event no longer special since 1.9", function() {
expect( 1 );
@ -2572,6 +2527,31 @@ test( "make sure events cloned correctly", 18, function() {
clone.find("#check1").trigger("change"); // 0 events should fire
});
test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() {
expect( 1 );
var errored = false;
String.prototype.namespace = function() {};
try {
jQuery("<p>").trigger("foo.bar");
} catch( e ) {
errored = true;
}
equal( errored, false, "trigger() did not throw exception" );
delete String.prototype.namespace;
});
test( "Inline event result is returned (#13993)", function() {
expect( 1 );
var result = jQuery("<p onclick='return 42'>hello</p>").triggerHandler("click");
equal( result, 42, "inline handler returned value" );
});
// This tests are unreliable in Firefox
if ( !(/firefox/i.test( window.navigator.userAgent )) ) {
test( "Check order of focusin/focusout events", 2, function() {
var focus, blur,
input = jQuery( "#name" );
@ -2599,25 +2579,48 @@ test( "Check order of focusin/focusout events", 2, function() {
input.off();
});
test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() {
expect( 1 );
var errored = false;
test("focus-blur order (#12868)", function() {
expect( 5 );
String.prototype.namespace = function() {};
var order,
$text = jQuery("#text1"),
$radio = jQuery("#radio1").trigger("focus");
try {
jQuery("<p>").trigger("foo.bar");
} catch( e ) {
errored = true;
// IE6-10 fire focus/blur events asynchronously; this is the resulting mess.
// IE's browser window must be topmost for this to work properly!!
stop();
$radio[0].focus();
setTimeout( function() {
$text
.on( "focus", function(){
equal( order++, 1, "text focus" );
})
.on( "blur", function(){
equal( order++, 0, "text blur" );
});
$radio
.on( "focus", function(){
equal( order++, 1, "radio focus" );
})
.on( "blur", function(){
equal( order++, 0, "radio blur" );
});
// Enabled input getting focus
order = 0;
equal( document.activeElement, $radio[0], "radio has focus" );
$text.trigger("focus");
setTimeout( function() {
equal( document.activeElement, $text[0], "text has focus" );
// Run handlers without native method on an input
order = 1;
$radio.triggerHandler( "focus" );
$text.off();
start();
}, 50 );
}, 50 );
});
}
equal( errored, false, "trigger() did not throw exception" );
delete String.prototype.namespace;
});
test( "Inline event result is returned (#13993)", function() {
expect( 1 );
var result = jQuery("<p onclick='return 42'>hello</p>").triggerHandler("click");
equal( result, 42, "inline handler returned value" );
});