X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fevent.js;h=e80774fa09d75fd3fc443b00379f8076ccea976e;hb=4f7441910f664800cca8d252f04ec479518edfe0;hp=fd91819356a45a8470a55a981cf6138658502d8e;hpb=4f99e793fa7a745ee49c73193891d6e2a40565c2;p=jquery.git diff --git a/test/unit/event.js b/test/unit/event.js index fd91819..e80774f 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"); }); /*