Created
April 13, 2022 18:51
-
-
Save tanner-west/6f9c334fa1ea42a30e376b30010c534c 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
describe('<MyInteractiveComponent/>', () => { | |
it('should update Name label when input is changed', () => { | |
// For a <TextInput />, use onChangeText() | |
const editNameInput = getByA11yLabel(wrapper, 'edit-name-input'); | |
editNameInput.props().onChangeText('Billy Budd'); | |
const name = getByA11yLabel(wrapper, 'name-text'); | |
expect(name.props().children).toEqual('Billy Budd'); | |
}); | |
it('should update Favorite Century label when picker input is changed', () => { | |
// For a <Picker />, use onValueChange() | |
const centuryPicker = getByTestId(wrapper, 'century-picker'); | |
centuryPicker.props().onValueChange('Nineteenth'); | |
const name = getByA11yLabel(wrapper, 'century-text'); | |
expect(name.props().children).toEqual('Nineteenth'); | |
}); | |
it('should open modal when button is pressed', () => { | |
// For a <Button />, use onPress() | |
const openModalButton = getByTestId(wrapper, 'open-modal-button'); | |
openModalButton.props().onPress(); | |
const modal = getByTestId(wrapper, 'modal'); | |
expect(modal.props().isVisible).toEqual(true); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment