Skip to content

Instantly share code, notes, and snippets.

@jhollingworth
Created May 19, 2015 16:16
Show Gist options
  • Save jhollingworth/08b4832bee7889b7d72a to your computer and use it in GitHub Desktop.
Save jhollingworth/08b4832bee7889b7d72a to your computer and use it in GitHub Desktop.
class User extends React.Component {
render() {
return (
<a href="#" ref="goHome" onClick={this.goHome}>
Go Home
</a>
);
}
goHome() {
this.context.router.transitionTo('home');
}
}
User.contextTypes = { router: React.PropTypes.object };
let transitionTo = sinon.stub();
let user = testTree(<User />, {
context: {
router: {
transitionTo: transitionTo
}
}
});
user.goHome.click();
expect(transitionTo).to.be.calledWith('dashboard');
@ThisIsMissEm
Copy link

Isn't line 26 meant to read: expect(transitionTo).to.be.calledWith('home'); ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment