-
Notifications
You must be signed in to change notification settings - Fork 254
Description
-
@testing-library/user-eventversion: 11.2.1 -
Testing Framework and version:
[email protected]
@testing-library/[email protected]
@testing-library/[email protected] -
DOM Environment:
jest-environment-jsdom
@jest-environment jsdom-sixteen
Relevant code or config
test("input: type uncontrolled", async () => {
render(<input type="text" defaultValue="Hello," />);
await userEvent.type(screen.getByRole("textbox"), "1234");
expect(screen.getByRole("textbox")).toHaveValue("Hello,1234");
});What you did:
Updated library from v10 to the latest version.
What happened:
Library types code incorrectly, if input or textarea already has text in it.
Reproduction repository:
https://codesandbox.io/s/user-event-type-to-add-text-issue-9hkpu?file=/src/__tests__/App.test.js
Problem description:
When typing in a input or textarea, when there is text already, typing happens in a weird manner.
In repository above, we have textarea with text Hello, in it. Then we type 1234. I checked all versions from 11.0.0 till the latest one and this behavior changed many times. Unfortunately, every time it was broken:
| Version | Controlled | Uncontrolled |
|---|---|---|
| 11.0.0 | Hello,1234 | Hello,1234 |
| 11.0.1 | Hello,4 | Hello,1234 |
| 11.1.0 | 234llo, | 234llo, |
| 11.2.0 | 234llo, | 234llo, |
| 11.2.1 | 1Hello,234 | 1Hello,234 |
As we can see version 11.0.1 introduced issues, and then they evolved.