Skip to content

Instantly share code, notes, and snippets.

@Lukeghenco
Last active January 16, 2019 01:01
Show Gist options
  • Save Lukeghenco/77de15847be707d40bcd67db4552adc2 to your computer and use it in GitHub Desktop.
Save Lukeghenco/77de15847be707d40bcd67db4552adc2 to your computer and use it in GitHub Desktop.
Enzyme/React-Testing-Libary Step: 8
it('will use the name prop to connect label to textarea tag if id prop is not present', () => {
const { getByLabelText, getByText } = render(<TextAreaInput {…defaultProps} id={null} />)
const label = getByText(defaultProps.labelText)
const textareaInput = getByLabelText(defaultProps.labelText)
expect(label.htmlFor).toEqual(defaultProps.name)
expect(textareaInput.id).toEqual(defaultProps.name)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment