Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simulating events with Jest and Material UI
// Simulating clicks
const dashboardMount = mount(
<Dashboard />, {
context: { muiTheme },
childContextTypes: { muiTheme: React.PropTypes.object }
}
)
const menuButton = ReactDOM.findDOMNode(dashboardMount.find(AppBar).find(IconButton).find('button').node)
TestUtils.Simulate.touchTap(menuButton)
expect(dashboardMount.find(Drawer).prop('open')).toBe(true)
const overlay = ReactDOM.findDOMNode(dashboardMount.find(Drawer).find(Overlay).find('div').node)
TestUtils.Simulate.touchTap(overlay)
expect(dashboardMount.find(Drawer).prop('open')).toBe(false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.