From: Dave Methvin Date: Thu, 28 Jul 2011 19:58:34 +0000 (-0400) Subject: Fix bad calls to .undelegate(). X-Git-Tag: 1.7b1~72 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8b4bd89addd2bab64656f699ee003aea03987c63;p=jquery.git Fix bad calls to .undelegate(). Remove two tests that assume "live" data structure. --- diff --git a/test/unit/event.js b/test/unit/event.js index c69ba8339..ecff5e331 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -371,7 +371,7 @@ test("bind/delegate bubbling, isDefaultPrevented", function() { }); fakeClick( $anchor2 ); $anchor2.unbind( "click" ); - $main.undelegate( "click" ); + $main.undelegate( "#foo", "click" ); $anchor2.click(function(e) { // Let the default action occur }); @@ -380,7 +380,7 @@ test("bind/delegate bubbling, isDefaultPrevented", function() { }); fakeClick( $anchor2 ); $anchor2.unbind( "click" ); - $main.undelegate( "click" ); + $main.undelegate( "#foo", "click" ); }); test("bind(), iframes", function() { @@ -1188,7 +1188,7 @@ test("toggle(Function, Function, ...)", function() { }); test(".live()/.die()", function() { - expect(66); + expect(65); var submit = 0, div = 0, livea = 0, liveb = 0; @@ -1284,9 +1284,6 @@ test(".live()/.die()", function() { jQuery("body").trigger("click"); equals( clicked, 2, "live with a context" ); - // Make sure the event is actually stored on the context - ok( jQuery._data(container, "events").live, "live with a context" ); - // Test unbinding with a different context jQuery("#foo", container).die("click"); jQuery("#foo").trigger("click"); @@ -1703,7 +1700,6 @@ test("live with special events", function() { jQuery("#liveSpan1").trigger("foo"); // Run: Handler 1, Default - // TODO: Namespace doesn't trigger default (?) jQuery("#liveSpan1").trigger("foo.a"); // Run: remove @@ -1719,7 +1715,7 @@ test("live with special events", function() { }); test(".delegate()/.undelegate()", function() { - expect(65); + expect(64); var submit = 0, div = 0, livea = 0, liveb = 0; @@ -1815,9 +1811,6 @@ test(".delegate()/.undelegate()", function() { jQuery("body").trigger("click"); equals( clicked, 2, "delegate with a context" ); - // Make sure the event is actually stored on the context - ok( jQuery._data(container, "events").live, "delegate with a context" ); - // Test unbinding with a different context jQuery("#qunit-fixture").undelegate("#foo", "click"); jQuery("#foo").trigger("click");