Skip to content

Commit 505e828

Browse files
author
Maxime Tyler
committed
add routeDepth into stubRouterContext method
Hello, If you want to test an element with `<RouteHandler />` component in it, you need in additional the `routeDepth` into `stubRouterContext`. I don't know the side effects but this was proposed by @taurose in the issue I have created: #1055 Best.
1 parent ba8195f commit 505e828

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/guides/testing.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,20 @@ var stubRouterContext = (Component, props, stubs) => {
7272
getCurrentParams () {},
7373
getCurrentQuery () {},
7474
isActive () {},
75+
getRouteAtDepth() {},
76+
setRouteComponentAtDepth() {}
7577
}, stubs)
7678

7779
return React.createClass({
7880
childContextTypes: {
79-
router: React.PropTypes.func
81+
router: React.PropTypes.func,
82+
routeDepth: React.PropTypes.number
8083
},
8184

8285
getChildContext () {
8386
return {
84-
router: RouterStub
87+
router: RouterStub,
88+
routeDepth: 0
8589
};
8690
},
8791

0 commit comments

Comments
 (0)