Skip to content

Instantly share code, notes, and snippets.

@skellock
Created June 27, 2016 13:00
Show Gist options
  • Save skellock/ad5072d165e14a979b408f5ce40b58c6 to your computer and use it in GitHub Desktop.
Save skellock/ad5072d165e14a979b408f5ce40b58c6 to your computer and use it in GitHub Desktop.
test('onPress', t => {
let i = 0
const onPress = () => i++
const wrapper = shallow(<Button onPress={onPress} text='hi' />)
t.is(wrapper.prop('onPress'), onPress) // uses the right handler
t.is(i, 0)
wrapper.simulate('press')
t.is(i, 1)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment