diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2011-12-13 21:40:59 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2011-12-13 21:40:59 -0500 |
commit | c584ce4f562536a282c6ccfd78d5d12080850517 (patch) | |
tree | c68b36d9c0c527b4cc158917ffc6268f295e76fc /test/unit | |
parent | 2a63b980eda1cf4ec1c2f27749821785c78c65b6 (diff) | |
download | jquery-c584ce4f562536a282c6ccfd78d5d12080850517.tar.gz jquery-c584ce4f562536a282c6ccfd78d5d12080850517.zip |
Fix #10984. Use origType when unbinding via the event object.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/event.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/unit/event.js b/test/unit/event.js index 4ad8f9d85..c5481ab0e 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2521,7 +2521,7 @@ test(".on and .off", function() { }); test("special bind/delegate name mapping", function() { - expect( 6 ); + expect( 7 ); jQuery.event.special.slap = { bindType: "click", @@ -2561,6 +2561,8 @@ test("special bind/delegate name mapping", function() { delegateType: "click", handle: function( event ) { equal( event.handleObj.origType, "gutfeeling", "got a gutfeeling" ); + // Need to call the handler since .one() uses it to unbind + return event.handleObj.handler.call( this , event ); } }; @@ -2579,6 +2581,13 @@ test("special bind/delegate name mapping", function() { .trigger( "gutfeeling" ) .remove(); + // Ensure .one() events are removed after their maiden voyage + jQuery( '<p>Gut Feeling</p>' ) + .one( "gutfeeling", jQuery.noop ) + .trigger( "gutfeeling" ) // This one should + .trigger( "gutfeeling" ) // This one should not + .remove(); + delete jQuery.event.special.gutfeeling; }); |