add unit test for m.route() overload

This commit is contained in:
Leo Horie 2014-04-28 22:41:04 -04:00
parent 9a9aef64cd
commit 6fb1071236

View file

@ -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() {