diff options
author | rwldrn <waldron.rick@gmail.com> | 2011-04-05 15:55:40 -0400 |
---|---|---|
committer | rwldrn <waldron.rick@gmail.com> | 2011-04-05 15:55:40 -0400 |
commit | 23a411b6bcbb96edbbfe53e11ec1671dccaa92b6 (patch) | |
tree | 10d3faf7fcfd8c0dfa20aa1941c1ee0ee03a401e /test/unit | |
parent | 2ed81b44be958b5f2b5569ab15f22bde262b4eb6 (diff) | |
download | jquery-23a411b6bcbb96edbbfe53e11ec1671dccaa92b6.tar.gz jquery-23a411b6bcbb96edbbfe53e11ec1671dccaa92b6.zip |
Ticket #8753 Allow special properties to explicitly defined on jQuery.Event objects
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/event.js | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/test/unit/event.js b/test/unit/event.js index 2a6d8a669..d19c7ec4a 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -685,7 +685,6 @@ test("hover()", function() { test("mouseover triggers mouseenter", function() { expect(1); - var count = 0, elem = jQuery("<a />"); elem.mouseenter(function () { @@ -693,7 +692,6 @@ test("mouseover triggers mouseenter", function() { }); elem.trigger('mouseover'); equals(count, 1, "make sure mouseover triggers a mouseenter" ); - elem.remove(); }); @@ -930,6 +928,27 @@ test("trigger(eventObject, [data], [fn])", function() { $parent.unbind().remove(); }); +test("jQuery.Event({ /* props */ })", function() { + + expect(4); + + var event = jQuery.Event({ type: "keydown", keyCode: 64 }), + handler = function( event ) { + ok( "keyCode" in event, "Special property 'keyCode' exists" ); + equal( event.keyCode, 64, "event.keyCode has explicit value '64'" ); + }; + + // Supports jQuery.Event implementation + equal( event.type, "keydown", "Verify type" ); + + ok( "keyCode" in event, "Special 'keyCode' property exists" ); + + jQuery("body").bind( "keydown", handler ).trigger( event ); + + jQuery("body").unbind( "keydown" ); + +}); + test("jQuery.Event.currentTarget", function(){ expect(1); @@ -1982,8 +2001,7 @@ test("window resize", function() { test("focusin bubbles", function() { expect(5); - - var input = jQuery( '<input type="text" />' ).prependTo( "body" ), + var input = jQuery( '<input type="text" />' ).prependTo( "body" ), order = 0; jQuery( "body" ).bind( "focusin.focusinBubblesTest", function(){ @@ -1996,12 +2014,10 @@ test("focusin bubbles", function() { // DOM focus method input[0].focus(); - // To make the next focus test work, we need to take focus off the input. // This will fire another focusin event, so set order to reflect that. order = 1; jQuery("#text1")[0].focus(); - // jQuery trigger, which calls DOM focus order = 0; input.trigger( "focus" ); @@ -2027,3 +2043,4 @@ test("event properties", function() { }).click(); }); */ + |