aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2012-08-07 20:49:34 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-08-07 20:49:34 -0400
commit1d8bf0a2b57fd429c600aab5b150b2a04b87e451 (patch)
tree5736e452f847ef346421a21277b6cf9ca9d4bc27 /test
parent37e8b44884cb9f5ceed84548c6e3961b449d98b2 (diff)
downloadjquery-1d8bf0a2b57fd429c600aab5b150b2a04b87e451.tar.gz
jquery-1d8bf0a2b57fd429c600aab5b150b2a04b87e451.zip
Fix #12203. .undelegate() should not remove direcly bound events.
Diffstat (limited to 'test')
-rw-r--r--test/unit/event.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index ecaddf3a4..16a9ff0fc 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -2376,18 +2376,24 @@ test("stopPropagation() stops directly-bound events on delegated target", functi
});
test("undelegate all bound events", function(){
- expect(1);
+ expect(2);
- var count = 0;
- var div = jQuery("#body");
+ var count = 0,
+ clicks = 0,
+ div = jQuery("#body");
- div.delegate("div#nothiddendivchild", "click submit", function(){ count++; });
+ div.delegate( "div#nothiddendivchild", "click submit", function(){ count++; } );
+ div.bind( "click", function(){ clicks++; } );
div.undelegate();
jQuery("div#nothiddendivchild").trigger("click");
jQuery("div#nothiddendivchild").trigger("submit");
equal( count, 0, "Make sure no events were triggered." );
+
+ div.trigger("click");
+ equal( clicks, 2, "Make sure delegated and directly bound event occurred." );
+ div.unbind("click");
});
test("delegate with multiple events", function(){