mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
stop[Immediate]Propagation tests
This commit is contained in:
@@ -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 '<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']);
|
||||
@@ -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 '<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);
|
||||
|
||||
Reference in New Issue
Block a user