Skip to content

Commit

Permalink
fix: callback with fully resolved route name (after adding a route)
Browse files Browse the repository at this point in the history
  • Loading branch information
troch committed Dec 26, 2016
1 parent dd72875 commit ca64573
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion modules/RouteNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ export default class RouteNode {
}
}

if (originalRoute) cb(originalRoute);
if (originalRoute) {
const fullName = route.getParentSegments([ route ]).map((_) => _.name).join('.');
cb({
...originalRoute,
name: fullName
});
}

return this;
}
Expand Down
8 changes: 4 additions & 4 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe('RouteNode', function () {

node.add(routes, function(route) {
i = i + 1;
if (i === 1) route.should.equal(routeA);
if (i === 2) route.should.equal(routeB);
if (i === 1) route.should.eql(routeA);
if (i === 2) route.should.eql(routeB);
});

i.should.not.equal(0);
Expand All @@ -52,8 +52,8 @@ describe('RouteNode', function () {

var node = new RouteNode('', '', routes, function(route) {
i = i + 1;
if (i === 1) route.should.equal(routeA);
if (i === 2) route.should.equal(routeB);
if (i === 1) route.should.eql(routeA);
if (i === 2) route.should.eql(routeB);
});

i.should.not.equal(0);
Expand Down

0 comments on commit ca64573

Please sign in to comment.