feat: bring back m.route.params()
Because it's annoying only having route params available to the top-level components within a route.
This commit is contained in:
parent
68f832d776
commit
834dd02610
2 changed files with 25 additions and 0 deletions
|
|
@ -1194,6 +1194,27 @@ o.spec("route", function() {
|
|||
done()
|
||||
}, FRAME_BUDGET * 2)
|
||||
})
|
||||
|
||||
o("m.route.params is available outside of route handlers", function(done) {
|
||||
$window.location.href = prefix + "/"
|
||||
|
||||
route(root, "/1", {
|
||||
"/:id" : {
|
||||
view : function() {
|
||||
o(route.params("id")).equals("1")
|
||||
|
||||
return m("div")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
callAsync(function() {
|
||||
o(route.params("id")).equals("1")
|
||||
o(route.params()).deepEquals({id:"1"})
|
||||
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue