Created
October 21, 2016 19:29
-
-
Save emilong/85d378bda92eda6483ee535a9347569a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Link.react-test.js | |
| import React from 'react'; | |
| import Link from '../Link.react'; | |
| import renderer from 'react-test-renderer'; | |
| test('Link changes the class when hovered', () => { | |
| const component = renderer.create( | |
| <Link page="http://www.facebook.com">Facebook</Link> | |
| ); | |
| let tree = component.toJSON(); | |
| expect(tree).toMatchSnapshot(); | |
| // manually trigger the callback | |
| tree.props.onMouseEnter(); | |
| // re-rendering | |
| tree = component.toJSON(); | |
| expect(tree).toMatchSnapshot(); | |
| // manually trigger the callback | |
| tree.props.onMouseLeave(); | |
| // re-rendering | |
| tree = component.toJSON(); | |
| expect(tree).toMatchSnapshot(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment