From 6fb1071236926baa446893b32db4faf6c654632b Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Mon, 28 Apr 2014 22:41:04 -0400 Subject: [PATCH] add unit test for m.route() overload --- tests/mithril-tests.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 48d3f9a9..72eb309e 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -415,6 +415,24 @@ function testMithril(mock) { var paramValueAfter = m.route.param("a1") return mock.location.search == "?/" && paramValueBefore === "foo" && paramValueAfter === undefined }) + test(function() { + //https://github.com/lhorie/mithril.js/issues/61 + mock.performance.$elapse(50) + mock.location.search = "?" + + var module = {controller: function() {}, view: function() {return m.route.param("a1")}} + + var root = mock.document.createElement("div") + m.route.mode = "search" + m.route(root, "/test7/foo", { + "/": module, + "/test7/:a1": module + }) + var routeValueBefore = m.route() + m.route("/") + var routeValueAfter = m.route() + return routeValueBefore === "/test7/foo" && routeValueAfter === "/" + }) //m.prop test(function() {