Skip to content

Commit d11fcfa

Browse files
committed
Fixed tests to run in IE9
1 parent 36c82a1 commit d11fcfa

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

test/unit/event.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,7 +2338,7 @@ test(".on and .off", function() {
23382338

23392339
test("delegated events quickIs", function() {
23402340
expect(17);
2341-
var markup = jQuery(
2341+
var markup = jQuery(
23422342
'<div>'+
23432343
'<p class="D">'+
23442344
'dead<b devo="cool">beat</b>club'+
@@ -2376,43 +2376,46 @@ test("delegated events quickIs", function() {
23762376
check( "p", "p|.D" );
23772377
check( "b", "b|[devo=cool] p|.D" );
23782378
check( "em", "em|em q|#famous em|em q|#famous" );
2379-
2379+
23802380
markup.find( "b" ).attr( "devo", "NO" );
23812381
check( "b", "b|[devo='NO'] p|.D" );
23822382

23832383
markup.remove();
23842384
});
23852385

23862386
test("propHooks extensions", function() {
2387-
expect( 3 );
2387+
expect( 2 );
23882388

23892389
// IE requires focusable elements to be visible, so append to body
2390-
var $fixture = jQuery( "<input type='text' id='hook-fixture' />" ).appendTo( "body" );
2390+
var $fixture = jQuery( "<input type='text' id='hook-fixture' />" ).appendTo( "body" ),
2391+
saved = jQuery.event.propHooks.click;
23912392

23922393
// Ensure the property doesn't exist
2393-
$fixture.bind( "focus", function( event ) {
2394+
$fixture.bind( "click", function( event ) {
23942395
ok( !("blurrinessLevel" in event), "event.blurrinessLevel does not exist" );
2395-
})[0].focus();
2396+
})[0].click();
2397+
2398+
// Must blur the link so click works below
2399+
$fixture.unbind( "click" )[0].blur();
2400+
2401+
// Define a custom property for "click" events via the filter function
2402+
//ok( !jQuery.event.propHooks.click, "We aren't clobbering an existing click hook" );
23962403

2397-
// Must blur the link so focus works below
2398-
$fixture.unbind( "focus" )[0].blur();
23992404

2400-
// Define a custom property for "focus" events via the filter function
2401-
ok( !jQuery.event.propHooks.focus, "We aren't clobbering an existing focus hook" );
2402-
jQuery.event.propHooks.focus = {
2405+
jQuery.event.propHooks.click = {
24032406
filter: function( event, originalEvent ) {
24042407
event.blurrinessLevel = 42;
24052408
return event;
24062409
}
24072410
};
24082411

2409-
// Trigger a native focus and ensure the property is set
2410-
$fixture.bind( "focus", function( event ) {
2412+
// Trigger a native click and ensure the property is set
2413+
$fixture.bind( "click", function( event ) {
24112414
equals( event.blurrinessLevel, 42, "event.blurrinessLevel was set" );
2412-
})[0].focus();
2415+
})[0].click();
24132416

2414-
delete jQuery.event.propHooks.focus;
2415-
$fixture.unbind( "focus" ).remove();
2417+
delete jQuery.event.propHooks.click;
2418+
$fixture.unbind( "click" ).remove();
24162419
});
24172420

24182421
(function(){

0 commit comments

Comments
 (0)