Skip to content

Commit c4efffe

Browse files
committed
update stubRouterContext
1 parent ea63b16 commit c4efffe

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webkid-react-starterkit",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "Lightweight starting point for a react web app.",
55
"keywords": [
66
"react",

test-utils/stubRouterContext.jsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
var React = require('react/addons');
22
var objectAssign = require('object-assign');
3-
var func = React.PropTypes.func;
43

54
var stubRouterContext = (Component, props, stubs) => {
5+
function RouterStub() { }
6+
7+
objectAssign(RouterStub, {
8+
makePath () {},
9+
makeHref () {},
10+
transitionTo () {},
11+
replaceWith () {},
12+
goBack () {},
13+
getCurrentPath () {},
14+
getCurrentRoutes () {},
15+
getCurrentPathname () {},
16+
getCurrentParams () {},
17+
getCurrentQuery () {},
18+
isActive () {},
19+
}, stubs)
20+
621
return React.createClass({
722
childContextTypes: {
8-
router: React.PropTypes.object
23+
router: React.PropTypes.func
924
},
1025

1126
getChildContext () {
1227
return {
13-
router: objectAssign({
14-
makePath () {},
15-
makeHref () {},
16-
transitionTo () {},
17-
replaceWith () {},
18-
goBack () {},
19-
getCurrentPath () {},
20-
getCurrentRoutes () {},
21-
getCurrentPathname () {},
22-
getCurrentParams () {},
23-
getCurrentQuery () {},
24-
isActive () {},
25-
}, stubs)
28+
router: RouterStub
2629
};
2730
},
2831

2932
render () {
30-
return <Component { ...props } />
33+
return <Component {...props} />
3134
}
3235
});
3336
};

0 commit comments

Comments
 (0)