add unit test for m.route() overload
This commit is contained in:
parent
9a9aef64cd
commit
6fb1071236
1 changed files with 18 additions and 0 deletions
|
|
@ -415,6 +415,24 @@ function testMithril(mock) {
|
||||||
var paramValueAfter = m.route.param("a1")
|
var paramValueAfter = m.route.param("a1")
|
||||||
return mock.location.search == "?/" && paramValueBefore === "foo" && paramValueAfter === undefined
|
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
|
//m.prop
|
||||||
test(function() {
|
test(function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue