From 1d0aa035c6ed64cbe67f144b6262314b40973ddd Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Mon, 30 Mar 2015 14:53:03 -0400 Subject: [PATCH] add test for #523 --- tests/mithril-tests.js | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index f050bcbc..c531e119 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -68,7 +68,6 @@ function testMithril(mock) { return root.childNodes.length }) - test(function() { mock.requestAnimationFrame.$resolve() @@ -947,6 +946,43 @@ function testMithril(mock) { return root.childNodes.length == 3 }) + test(function() { + var root = mock.document.createElement("div") + var show = true + var testcomponent = { + controller: function() {}, + view: function() { + return m('div', 'component'); + } + }; + + var app = { + view: function(scope) { + return show ? [ + m('h1', '1'), + testcomponent + ] : [ + m('h1', '2'), + ]; + } + }; + + m.module(root, app); + + mock.requestAnimationFrame.$resolve() + + show = false + m.redraw() + + mock.requestAnimationFrame.$resolve() + + show = true + m.redraw() + + mock.requestAnimationFrame.$resolve() + + return root.childNodes.length == 2 + }) m.redraw.strategy(undefined) //teardown for m.module tests //m.withAttr