mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Don't execute focus tests in Firefox
Cherry picked from 45be91e398
commit
This commit is contained in:
parent
d6fc713e26
commit
7f829752e6
@ -2419,51 +2419,6 @@ test("checkbox state (#3827)", function() {
|
|||||||
jQuery( cb ).triggerHandler( "click" );
|
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() {
|
test("hover event no longer special since 1.9", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
|
|
||||||
@ -2645,7 +2600,32 @@ 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
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "Check order of focusin/focusout events", 2, function() {
|
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,
|
var focus, blur,
|
||||||
input = jQuery( "#name" );
|
input = jQuery( "#name" );
|
||||||
|
|
||||||
@ -2670,27 +2650,50 @@ test( "Check order of focusin/focusout events", 2, function() {
|
|||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
input.off();
|
input.off();
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "String.prototype.namespace does not cause trigger() to throw (#13360)", function() {
|
test("focus-blur order (#12868)", function() {
|
||||||
expect( 1 );
|
expect( 5 );
|
||||||
var errored = false;
|
|
||||||
|
|
||||||
String.prototype.namespace = function() {};
|
var order,
|
||||||
|
$text = jQuery("#text1"),
|
||||||
|
$radio = jQuery("#radio1").trigger("focus");
|
||||||
|
|
||||||
try {
|
// IE6-10 fire focus/blur events asynchronously; this is the resulting mess.
|
||||||
jQuery("<p>").trigger("foo.bar");
|
// IE's browser window must be topmost for this to work properly!!
|
||||||
} catch( e ) {
|
stop();
|
||||||
errored = true;
|
$radio[0].focus();
|
||||||
}
|
|
||||||
equal( errored, false, "trigger() did not throw exception" );
|
|
||||||
delete String.prototype.namespace;
|
|
||||||
});
|
|
||||||
|
|
||||||
test( "Inline event result is returned (#13993)", function() {
|
setTimeout( function() {
|
||||||
expect( 1 );
|
|
||||||
|
|
||||||
var result = jQuery("<p onclick='return 42'>hello</p>").triggerHandler("click");
|
$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" );
|
||||||
|
});
|
||||||
|
|
||||||
equal( result, 42, "inline handler returned value" );
|
// 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 );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user