fix invalidation test

This commit is contained in:
Leo Horie 2016-12-06 16:53:16 -05:00
parent 19729bccdf
commit d8ad94adb2

View file

@ -640,16 +640,22 @@ o.spec("route", function() {
}) })
o("calling route.set invalidates pending onmatch resolution", function(done) { o("calling route.set invalidates pending onmatch resolution", function(done) {
var rendered = false
var resolved var resolved
$window.location.href = prefix + "/a" $window.location.href = prefix + "/a"
route(root, "/a", { route(root, "/a", {
"/a": { "/a": {
onmatch: function() { onmatch: function() {
return Promise.resolve(function(resolve) { return new Promise(function(resolve) {
setTimeout(resolve, 0) callAsync(function() {
callAsync(function() {
resolve({view: function() {}})
})
})
}) })
}, },
render: function(vnode) { render: function(vnode) {
rendered = true
resolved = "a" resolved = "a"
} }
}, },
@ -662,11 +668,12 @@ o.spec("route", function() {
route.set("/b") route.set("/b")
setTimeout(function() { callAsync(function() {
o(rendered).equals(false)
o(resolved).equals("b") o(resolved).equals("b")
done() done()
}, 2) //FIXME magic number })
}) })
o("route changes activate onbeforeremove", function(done) { o("route changes activate onbeforeremove", function(done) {