diff options
author | rwldrn <waldron.rick@gmail.com> | 2011-01-01 13:49:59 -0500 |
---|---|---|
committer | rwldrn <waldron.rick@gmail.com> | 2011-01-01 13:49:59 -0500 |
commit | 612a908514b6ad6ec35754b0193887b01ce2c9f2 (patch) | |
tree | 2e74f730ba2b2507dd85979d9747397678ca443e /test/unit/event.js | |
parent | eed3803c98bf5c074e40aad12f2e91435bf81154 (diff) | |
download | jquery-612a908514b6ad6ec35754b0193887b01ce2c9f2.tar.gz jquery-612a908514b6ad6ec35754b0193887b01ce2c9f2.zip |
#7883 .delegate and .live should accept false as the fn arg, like bind
Diffstat (limited to 'test/unit/event.js')
-rw-r--r-- | test/unit/event.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/unit/event.js b/test/unit/event.js index b4672a8b8..01fbac574 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -527,6 +527,45 @@ test("bind(name, false), unbind(name, false)", function() { equals( main, 1, "Verify that the trigger happened correctly." ); }); +test("live(name, false), die(name, false)", function() { + expect(3); + + var main = 0; + jQuery("#main").live("click", function(e){ main++; }); + jQuery("#ap").trigger("click"); + equals( main, 1, "Verify that the trigger happened correctly." ); + + main = 0; + jQuery("#ap").live("click", false); + jQuery("#ap").trigger("click"); + equals( main, 0, "Verify that no bubble happened." ); + + main = 0; + jQuery("#ap").die("click", false); + jQuery("#ap").trigger("click"); + equals( main, 1, "Verify that the trigger happened correctly." ); +}); + +test("delegate(selector, name, false), undelegate(selector, name, false)", function() { + expect(3); + + var main = 0; + + jQuery("#main").delegate("#ap", "click", function(e){ main++; }); + jQuery("#ap").trigger("click"); + equals( main, 1, "Verify that the trigger happened correctly." ); + + main = 0; + jQuery("#ap").delegate("#groups", "click", false); + jQuery("#groups").trigger("click"); + equals( main, 0, "Verify that no bubble happened." ); + + main = 0; + jQuery("#ap").undelegate("#groups", "click", false); + jQuery("#groups").trigger("click"); + equals( main, 1, "Verify that the trigger happened correctly." ); +}); + test("bind()/trigger()/unbind() on plain object", function() { expect( 8 ); |