Feature onmatch route param (#2371)

* added route param in onmatch

* fix docs

* included test

* docs fix
This commit is contained in:
Yogesh Khatri 2019-02-07 15:42:53 +05:30 committed by Isiah Meadows
parent 6f8f011b88
commit a9172f1129
3 changed files with 15 additions and 9 deletions

View file

@ -321,11 +321,12 @@ o.spec("route", function() {
}
var resolver = {
onmatch: function(args, requestedPath) {
onmatch: function(args, requestedPath, route) {
matchCount++
o(args.id).equals("abc")
o(requestedPath).equals("/abc")
o(route).equals("/:id")
o(this).equals(resolver)
return Component
},
@ -362,11 +363,12 @@ o.spec("route", function() {
}
var resolver = {
onmatch: function(args, requestedPath) {
onmatch: function(args, requestedPath, route) {
matchCount++
o(args.id).equals("abc")
o(requestedPath).equals("/abc")
o(route).equals("/:id")
o(this).equals(resolver)
return Promise.resolve(Component)
},
@ -398,11 +400,12 @@ o.spec("route", function() {
var renderCount = 0
var resolver = {
onmatch: function(args, requestedPath) {
onmatch: function(args, requestedPath, route) {
matchCount++
o(args.id).equals("abc")
o(requestedPath).equals("/abc")
o(route).equals("/:id")
o(this).equals(resolver)
return Promise.resolve()
},
@ -434,11 +437,12 @@ o.spec("route", function() {
var renderCount = 0
var resolver = {
onmatch: function(args, requestedPath) {
onmatch: function(args, requestedPath, route) {
matchCount++
o(args.id).equals("abc")
o(requestedPath).equals("/abc")
o(route).equals("/:id")
o(this).equals(resolver)
return Promise.resolve([])
},
@ -508,11 +512,12 @@ o.spec("route", function() {
$window.location.href = prefix + "/abc"
route(root, "/abc", {
"/:id" : {
onmatch: function(args, requestedPath) {
onmatch: function(args, requestedPath, route) {
matchCount++
o(args.id).equals("abc")
o(requestedPath).equals("/abc")
o(route).equals("/:id")
return Component
},