fix back button on default route trigger

This commit is contained in:
Leo Horie 2016-07-15 01:22:34 -04:00
parent a2680b30a4
commit 084d99f125
2 changed files with 42 additions and 3 deletions

View file

@ -49,6 +49,45 @@ o.spec("route", function() {
})
})
o("default route doesn't break back button", function(done) {
$window.location.href = "http://google.com"
route(root, "/a", {
"/a" : {
view: function() {
return m("div")
}
}
})
setTimeout(function() {
o(root.firstChild.nodeName).equals("DIV")
$window.history.back()
o($window.location.pathname).equals("/")
done()
}, FRAME_BUDGET)
})
o("default route does not inherit params", function(done) {
$window.location.href = "/invalid?foo=bar"
route(root, "/a", {
"/a" : {
oninit: init,
view: function() {
return m("div")
}
}
})
function init(vnode) {
o(vnode.attrs).deepEquals({})
done()
}
})
o("redraws when render function is executed", function(done) {
var onupdate = o.spy()
var oninit = o.spy()