Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (22 sloc) 674 Bytes
id title
ecosystem-user-event
user-event

user-event is a companion library for react-testing-library that provides more advanced simulation of browser interactions than the built-in fireEvent method.

npm install --save-dev user-event
import React from 'react'
import { render } from 'react-testing-library'
import userEvent from 'user-event'

const { getByText } = test('click', () => {
  render(<textarea data-testid="email" />)
})

userEvent.type(getByTestId('email'), 'Hello, World!')
expect(getByTestId('email')).toHaveAttribute('value', 'Hello, World!')
You can’t perform that action at this time.