Created
August 14, 2015 04:40
-
-
Save ianshea/8ba588b7d69049468a8c to your computer and use it in GitHub Desktop.
React Router Test Stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stub extends React.Component { | |
static childContextTypes = { | |
router: React.PropTypes.object.isRequired | |
}; | |
getChildContext() { | |
return { | |
router: { | |
makePath(pathname, query) { }, | |
makeHref(pathname, query) { }, | |
transitionTo(pathname, query, state=null) { }, | |
replaceWith(pathname, query, state=null) { }, | |
go(n) { }, | |
goBack() { }, | |
goForward() { }, | |
isActive(pathname, query) { } | |
} | |
}; | |
} | |
render() { | |
return this.props.children(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pulled this out of a React Router issue. Will try and go back and find the issue and give credit where it's due!