From 337ec325b33cc980d84f6f16c8f5e6af01d79fdb Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 22 Apr 2015 07:31:59 +0930 Subject: [PATCH] Add test case --- tests/mithril-tests.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 2b571de1..b7b4d1bf 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -3405,6 +3405,39 @@ function testMithril(mock) { return initCount == 1 }) + test(function() { + // https://github.com/lhorie/mithril.js/pull/571 + mock.requestAnimationFrame.$resolve() + mock.location.search = "?" + + var root = mock.document.createElement("div") + + var a = {} + a.controller = function() {} + a.view = function() { + return m("div", {config: function(elm, init, ctx) { + elm.childNodes[0].modified = true + }}, m("div")) + } + + var b = {} + b.controller = function() {} + b.view = function() { + return m("div", m("div")) + } + + m.route(root, "/a", { + "/a": a, + "/b": b, + }) + mock.requestAnimationFrame.$resolve() + + m.route("/b") + + mock.requestAnimationFrame.$resolve() + + return !root.childNodes[0].childNodes[0].modified; + }); //end m.route //m.route.parseQueryString