diff --git a/packages/templating/templating_tests.html b/packages/templating/templating_tests.html index 0cfa76c5c0..d44420cd02 100644 --- a/packages/templating/templating_tests.html +++ b/packages/templating/templating_tests.html @@ -326,3 +326,23 @@ + + + + + + + + diff --git a/packages/templating/templating_tests.js b/packages/templating/templating_tests.js index a43f58c60d..5c3d9717e5 100644 --- a/packages/templating/templating_tests.js +++ b/packages/templating/templating_tests.js @@ -1032,3 +1032,39 @@ Tinytest.add('templating - helper typecast Issue #617', function (test) { "[object]"); }); +Tinytest.add("templating - tricky branch labels", function (test) { + // regression test for issue #724 + + var loading = ReactiveVar(true); + var v = ReactiveVar(1); + + var x = []; + + Template.test_template_trickylabels_a0.loading = function () { + return loading.get(); + }; + + Template.test_template_trickylabels_a1.v = function () { + return v.get(); + }; + + _.extend(Template.test_template_trickylabels_a2, { + created: function () { x.push('c'); }, + rendered: function () { x.push('r'); }, + destroyed: function () { x.push('d'); } + }); + + var div = OnscreenDiv(Meteor.render(Template.test_template_trickylabels_a0)); + Meteor.flush(); + loading.set(false); + Meteor.flush(); + x.length = 0; + + v.set(2); + Meteor.flush(); + test.equal(x.join(''), 'r'); // no 'c' or 'd' + test.equal(div.html().replace(/\s+/g, ''), '
foo
2
bar
'); + + div.kill(); + Meteor.flush(); +});