add tests for variadic route

This commit is contained in:
Leo Horie 2014-05-07 10:27:45 -04:00
parent 0f1c9bcfba
commit 3bccf4d2ef

View file

@ -489,6 +489,40 @@ function testMithril(mock) {
mock.performance.$elapse(50) //teardown
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
test(function() {