Check that the 2nd argument to m.route is a string

This commit is contained in:
Richard Eames 2014-09-18 10:57:30 -06:00
parent e94a0a7c22
commit c3d3fa7315
2 changed files with 33 additions and 1 deletions

View file

@ -1525,6 +1525,38 @@ function testMithril(mock) {
mock.requestAnimationFrame.$resolve() //teardown
return mock.location.search == "?/test23/" && root.childNodes[0].nodeValue === "bar"
})
test(function() {
mock.requestAnimationFrame.$resolve() //setup
mock.location.search = "?"
var root = mock.document.createElement("div")
var value
m.route(root, String("/foo+bar"), {
"/:arg": {
controller: function() {value = m.route.param("arg")},
view: function(ctrl) {
return ""
}
}
})
return value == "foo+bar"
})
test(function() {
mock.requestAnimationFrame.$resolve() //setup
mock.location.search = "?"
var root = mock.document.createElement("div")
var value
m.route(root, new String("/foo+bar"), {
"/:arg": {
controller: function() {value = m.route.param("arg")},
view: function(ctrl) {
return ""
}
}
})
return value == "foo+bar"
})
//end m.route
//m.prop