Add test for the context of onmatch and render
This commit is contained in:
parent
7ee34c122d
commit
58275417d4
1 changed files with 20 additions and 17 deletions
|
|
@ -238,25 +238,28 @@ o.spec("route", function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$window.location.href = prefix + "/abc"
|
var resolver = {
|
||||||
route(root, "/abc", {
|
|
||||||
"/:id" : {
|
|
||||||
onmatch: function(resolve, args, requestedPath) {
|
onmatch: function(resolve, args, requestedPath) {
|
||||||
matchCount++
|
matchCount++
|
||||||
|
|
||||||
o(args.id).equals("abc")
|
o(args.id).equals("abc")
|
||||||
o(requestedPath).equals("/abc")
|
o(requestedPath).equals("/abc")
|
||||||
|
o(this).equals(resolver)
|
||||||
resolve(Component)
|
resolve(Component)
|
||||||
},
|
},
|
||||||
render: function(vnode) {
|
render: function(vnode) {
|
||||||
renderCount++
|
renderCount++
|
||||||
|
|
||||||
o(vnode.attrs.id).equals("abc")
|
o(vnode.attrs.id).equals("abc")
|
||||||
|
o(this).equals(resolver)
|
||||||
|
|
||||||
return vnode
|
return vnode
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
|
||||||
|
$window.location.href = prefix + "/abc"
|
||||||
|
route(root, "/abc", {
|
||||||
|
"/:id" : resolver
|
||||||
})
|
})
|
||||||
|
|
||||||
o(matchCount).equals(1)
|
o(matchCount).equals(1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue