add tests for variadic route
This commit is contained in:
parent
0f1c9bcfba
commit
3bccf4d2ef
1 changed files with 34 additions and 0 deletions
|
|
@ -489,6 +489,40 @@ function testMithril(mock) {
|
||||||
mock.performance.$elapse(50) //teardown
|
mock.performance.$elapse(50) //teardown
|
||||||
return routeValueBefore === "/test7/foo" && routeValueAfter === "/"
|
return routeValueBefore === "/test7/foo" && routeValueAfter === "/"
|
||||||
})
|
})
|
||||||
|
test(function() {
|
||||||
|
mock.performance.$elapse(50) //setup
|
||||||
|
mock.location.search = "?"
|
||||||
|
|
||||||
|
var root = mock.document.createElement("div")
|
||||||
|
m.route.mode = "search"
|
||||||
|
m.route(root, "/test8/foo/SEP/bar/baz", {
|
||||||
|
"/test8/:test/SEP/:path...": {
|
||||||
|
controller: function() {},
|
||||||
|
view: function() {
|
||||||
|
return m.route.param("test") + "_" + m.route.param("path")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
mock.performance.$elapse(50) //teardown
|
||||||
|
return mock.location.search == "?/test8/foo/SEP/bar/baz" && root.childNodes[0].nodeValue === "foo_bar/baz"
|
||||||
|
})
|
||||||
|
test(function() {
|
||||||
|
mock.performance.$elapse(50) //setup
|
||||||
|
mock.location.search = "?"
|
||||||
|
|
||||||
|
var root = mock.document.createElement("div")
|
||||||
|
m.route.mode = "search"
|
||||||
|
m.route(root, "/test9/foo/bar/SEP/baz", {
|
||||||
|
"/test9/:test.../SEP/:path": {
|
||||||
|
controller: function() {},
|
||||||
|
view: function() {
|
||||||
|
return m.route.param("test") + "_" + m.route.param("path")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
mock.performance.$elapse(50) //teardown
|
||||||
|
return mock.location.search == "?/test9/foo/bar/SEP/baz" && root.childNodes[0].nodeValue === "foo/bar_baz"
|
||||||
|
})
|
||||||
|
|
||||||
//m.prop
|
//m.prop
|
||||||
test(function() {
|
test(function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue