Skip to content

Commit

Permalink
stop[Immediate]Propagation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dgreensp committed Jul 13, 2012
1 parent deba0fb commit 9cea9aa
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions packages/liveui/liveui_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -1372,14 1372,31 @@ Tinytest.add("liveui - event handling", function(test) {
return '<span id="foozy" class="a b c">Hello</span>';
}, {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']);
event_buf.length = 0;
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 '<span id="foozy" class="a b c">Hello</span>';
}, {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);
Expand Down

0 comments on commit 9cea9aa

Please sign in to comment.