From 9cea9aa20590e9f8aae26b434eb950bb783d31ca Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Thu, 12 Jul 2012 15:12:29 -0700 Subject: [PATCH] stop[Immediate]Propagation tests --- packages/liveui/liveui_tests.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/liveui/liveui_tests.js b/packages/liveui/liveui_tests.js index 88af62a891..4824e60e7b 100644 --- a/packages/liveui/liveui_tests.js +++ b/packages/liveui/liveui_tests.js @@ -1363,7 +1363,7 @@ Tinytest.add("liveui - event handling", function(test) { div.kill(); Meteor.flush(); - // stopPropagationd doesn't prevent other event maps from + // stopPropagation doesn't prevent other event maps from // handling same node event_buf.length = 0; div = OnscreenDiv(Meteor.ui.render(function() { @@ -1372,7 +1372,7 @@ Tinytest.add("liveui - event handling", function(test) { return 'Hello'; }, {events: eventmap("click .c"), event_data:event_buf}); }, {events: {"click .b": function(evt) { - event_buf.push("click .b"); evt.stopPropagation(); return false;}}}); + event_buf.push("click .b"); evt.stopPropagation();}}}); }, {events: eventmap("click .a"), event_data:event_buf})); clickElement(getid("foozy")); test.equal(event_buf, ['click .c', 'click .b', 'click .a']); @@ -1380,6 +1380,23 @@ Tinytest.add("liveui - event handling", function(test) { div.kill(); Meteor.flush(); + // stopImmediatePropagation DOES + event_buf.length = 0; + div = OnscreenDiv(Meteor.ui.render(function() { + return Meteor.ui.chunk(function() { + return Meteor.ui.chunk(function() { + return 'Hello'; + }, {events: eventmap("click .c"), event_data:event_buf}); + }, {events: {"click .b": function(evt) { + event_buf.push("click .b"); + evt.stopImmediatePropagation();}}}); + }, {events: eventmap("click .a"), event_data:event_buf})); + clickElement(getid("foozy")); + test.equal(event_buf, ['click .c', 'click .b']); + event_buf.length = 0; + div.kill(); + Meteor.flush(); + // bubbling continues even with DOM change event_buf.length = 0; R = ReactiveVar(true);