Add an assertion for RouteResolver.render calls on route.set(route.get())
This commit is contained in:
parent
2ffd2fb7e4
commit
b6c8e2c63e
1 changed files with 4 additions and 1 deletions
|
|
@ -514,21 +514,24 @@ o.spec("route", function() {
|
||||||
|
|
||||||
o("m.route.set(m.route.get()) re-runs the resolution logic (#1180)", function(done){
|
o("m.route.set(m.route.get()) re-runs the resolution logic (#1180)", function(done){
|
||||||
var onmatch = o.spy(function(resolve) {resolve()})
|
var onmatch = o.spy(function(resolve) {resolve()})
|
||||||
|
var render = o.spy(function(){return m("div")})
|
||||||
|
|
||||||
$window.location.href = prefix + "/"
|
$window.location.href = prefix + "/"
|
||||||
route(root, '/', {
|
route(root, '/', {
|
||||||
"/":{
|
"/":{
|
||||||
onmatch: onmatch,
|
onmatch: onmatch,
|
||||||
render: function(){return m("div")}
|
render: render
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
o(onmatch.callCount).equals(1)
|
o(onmatch.callCount).equals(1)
|
||||||
|
o(render.callCount).equals(1)
|
||||||
|
|
||||||
route.set(route.get())
|
route.set(route.get())
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(onmatch.callCount).equals(2)
|
o(onmatch.callCount).equals(2)
|
||||||
|
o(render.callCount).equals(2)
|
||||||
|
|
||||||
done()
|
done()
|
||||||
}, FRAME_BUDGET)
|
}, FRAME_BUDGET)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue