add support for route state #1480

This commit is contained in:
Leo Horie 2016-12-17 21:50:04 -05:00
parent 75e83ea565
commit de07a54881
10 changed files with 367 additions and 196 deletions

View file

@ -150,6 +150,18 @@ o.spec("Router.setPath", function() {
o($window.location.href).equals(env.protocol + "//" + (env.hostname === "/" ? "" : env.hostname) + slash + (prefix ? prefix + "/" : "") + "test")
done()
})
})
o("state works", function(done) {
$window.location.href = prefix + "/test"
router.defineRoutes({"/test": {data: 1}, "/other": {data: 2}}, onRouteChange, onFail)
callAsync(function() {
router.setPath("/other", null, {state: {a: 1}})
o($window.history.state).deepEquals({a: 1})
done()
})
})