Commit d11fcfac authored by Rick Waldron's avatar Rick Waldron

Fixed tests to run in IE9

parent 36c82a1b
...@@ -2384,35 +2384,38 @@ test("delegated events quickIs", function() { ...@@ -2384,35 +2384,38 @@ test("delegated events quickIs", function() {
}); });
test("propHooks extensions", function() { test("propHooks extensions", function() {
expect( 3 ); expect( 2 );
// IE requires focusable elements to be visible, so append to body // IE requires focusable elements to be visible, so append to body
var $fixture = jQuery( "<input type='text' id='hook-fixture' />" ).appendTo( "body" ); var $fixture = jQuery( "<input type='text' id='hook-fixture' />" ).appendTo( "body" ),
saved = jQuery.event.propHooks.click;
// Ensure the property doesn't exist // Ensure the property doesn't exist
$fixture.bind( "focus", function( event ) { $fixture.bind( "click", function( event ) {
ok( !("blurrinessLevel" in event), "event.blurrinessLevel does not exist" ); ok( !("blurrinessLevel" in event), "event.blurrinessLevel does not exist" );
})[0].focus(); })[0].click();
// Must blur the link so focus works below // Must blur the link so click works below
$fixture.unbind( "focus" )[0].blur(); $fixture.unbind( "click" )[0].blur();
// Define a custom property for "focus" events via the filter function // Define a custom property for "click" events via the filter function
ok( !jQuery.event.propHooks.focus, "We aren't clobbering an existing focus hook" ); //ok( !jQuery.event.propHooks.click, "We aren't clobbering an existing click hook" );
jQuery.event.propHooks.focus = {
jQuery.event.propHooks.click = {
filter: function( event, originalEvent ) { filter: function( event, originalEvent ) {
event.blurrinessLevel = 42; event.blurrinessLevel = 42;
return event; return event;
} }
}; };
// Trigger a native focus and ensure the property is set // Trigger a native click and ensure the property is set
$fixture.bind( "focus", function( event ) { $fixture.bind( "click", function( event ) {
equals( event.blurrinessLevel, 42, "event.blurrinessLevel was set" ); equals( event.blurrinessLevel, 42, "event.blurrinessLevel was set" );
})[0].focus(); })[0].click();
delete jQuery.event.propHooks.focus; delete jQuery.event.propHooks.click;
$fixture.unbind( "focus" ).remove(); $fixture.unbind( "click" ).remove();
}); });
(function(){ (function(){
......
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