Add an assertion for RouteResolver.render calls on route.set(route.get())

This commit is contained in:
Pierre-Yves Gerardy 2016-12-04 23:25:04 +01:00
parent 2ffd2fb7e4
commit b6c8e2c63e

View file

@ -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)