Skip to content

Instantly share code, notes, and snippets.

@dferber90
Created May 18, 2018 05:00
Show Gist options
  • Save dferber90/75b022e17bfecb60f1ce20cfab4f0a2c to your computer and use it in GitHub Desktop.
Save dferber90/75b022e17bfecb60f1ce20cfab4f0a2c to your computer and use it in GitHub Desktop.
Test a Render Prop!
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