aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/event.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-02-27 09:02:13 -0500
committerjeresig <jeresig@gmail.com>2010-02-27 09:02:13 -0500
commita45372a4c5cfd33c4ff12b145bd79fec2fe0d382 (patch)
treed742e359770aa2f7070626e4e71374518b85b501 /test/unit/event.js
parentba7195e3f90b3a3130ac0b15880ba2f27106f568 (diff)
downloadjquery-a45372a4c5cfd33c4ff12b145bd79fec2fe0d382.tar.gz
jquery-a45372a4c5cfd33c4ff12b145bd79fec2fe0d382.zip
Adding in .bind(name, false), .unbind(name, false) support - an easy way to just stop bubbling and the default action on an element. Fixes #6188.
Diffstat (limited to 'test/unit/event.js')
-rw-r--r--test/unit/event.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index 640490021..a9c88153f 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -384,6 +384,25 @@ test("bind(), with different this object", function() {
ok( !jQuery.data(jQuery("#firstp")[0], "events"), "Event handler unbound when using different this object and data." );
});
+test("bind(name, false), unbind(name, false)", function() {
+ expect(3);
+
+ var main = 0;
+ jQuery("#main").bind("click", function(e){ main++; });
+ jQuery("#ap").trigger("click");
+ equals( main, 1, "Verify that the trigger happened correctly." );
+
+ main = 0;
+ jQuery("#ap").bind("click", false);
+ jQuery("#ap").trigger("click");
+ equals( main, 0, "Verify that no bubble happened." );
+
+ main = 0;
+ jQuery("#ap").unbind("click", false);
+ jQuery("#ap").trigger("click");
+ equals( main, 1, "Verify that the trigger happened correctly." );
+});
+
test("bind()/trigger()/unbind() on plain object", function() {
expect( 2 );