From ba641f1e7a212bfa91bb99b4e1f5063e93bfcb6c Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Fri, 8 Jun 2012 19:53:01 -0700 Subject: [PATCH] liveui test for unused chunk --- packages/liveui/liveui_tests.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/liveui/liveui_tests.js b/packages/liveui/liveui_tests.js index db7f9485da..2fd7b19146 100644 --- a/packages/liveui/liveui_tests.js +++ b/packages/liveui/liveui_tests.js @@ -700,6 +700,25 @@ Tinytest.add("liveui - chunks", function(test) { }); }); + + // unused chunk + + var Q = ReactiveVar("foo"); + Meteor.ui.render(function() { + // create a chunk, in render mode, + // but don't use it. + Meteor.ui.chunk(function() { + return Q.get(); + }); + return ""; + }); + test.equal(Q.numListeners(), 1); + Q.set("bar"); + // flush() should invalidate the unused + // chunk but not assume it has been wired + // up with a LiveRange. + Meteor.flush(); + test.equal(Q.numListeners(), 0); }); Tinytest.add("liveui - repeated chunk", function(test) {