aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2008-12-30 20:45:33 +0000
committerJohn Resig <jeresig@gmail.com>2008-12-30 20:45:33 +0000
commit4f7441910f664800cca8d252f04ec479518edfe0 (patch)
tree76769d8dceb15c1f488ff2800d2a72ada13c46dc /test/unit
parenta1ca9427eca113e6747e99a86b2283e3a6f63502 (diff)
downloadjquery-4f7441910f664800cca8d252f04ec479518edfe0.tar.gz
jquery-4f7441910f664800cca8d252f04ec479518edfe0.zip
Made sure that return false works in .live() along with the event object being passed in as the first argument.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/event.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/unit/event.js b/test/unit/event.js
index fd9181935..e80774fa0 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -439,7 +439,7 @@ test("toggle(Function, Function, ...)", function() {
});
test(".live()/.die()", function() {
- expect(28);
+ expect(30);
var submit = 0, div = 0, livea = 0, liveb = 0;
@@ -501,6 +501,20 @@ test(".live()/.die()", function() {
jQuery("div#nothiddendiv").die("click");
jQuery("div").die("click");
jQuery("div").die("submit");
+
+ // Verify that return false prevents default action
+ jQuery("#anchor2").live("click", function(){ return false; });
+ var hash = window.location.hash;
+ jQuery("#anchor2").trigger("click");
+ equals( window.location.hash, hash, "return false worked" );
+ jQuery("#anchor2").die("click");
+
+ // Verify that .preventDefault() prevents default action
+ jQuery("#anchor2").live("click", function(e){ e.preventDefault(); });
+ var hash = window.location.hash;
+ jQuery("#anchor2").trigger("click");
+ equals( window.location.hash, hash, "e.preventDefault() worked" );
+ jQuery("#anchor2").die("click");
});
/*