Created
May 18, 2018 05:00
-
-
Save dferber90/75b022e17bfecb60f1ce20cfab4f0a2c to your computer and use it in GitHub Desktop.
Test a Render Prop!
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
describe('when <App /> renders nested render props', () => { | |
const wrapper = shallow(<SuperApp />); | |
const mouseWrapper = shallow( | |
<div>{wrapper.find(Mouse).prop('render')({ x: 0, y: 0 })}</div> | |
); | |
const mouseDownWrapper = shallow( | |
mouseWrapper.find(MouseDown).prop('render')({ down: true }) | |
); | |
it('should render a string containing the coordinates', () => { | |
expect(mouseDownWrapper.text()).toEqual( | |
'The mouse position is (0, 0) and the button is down' | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment