Testing · Junior · Question 51 of 78
How do you type text into an input with user-event v14?
const user = userEvent.setup();
render(<Login />);
await user.type(screen.getByLabelText("Email"), "ann@example.com");- ✓Correct answer: As shown: create
userwithsetup()andawaitthe call - 2Call
userEvent.typewithoutawait- it's synchronous - 3Set
input.valuedirectly
Explanation
In v14 all methods return promises. Setting value directly skips the events React listens to.