Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type regression if input or textarea has text in it (11.0.1+) #321

Closed
hudochenkov opened this issue Jun 8, 2020 · 5 comments · Fixed by #322
Closed

type regression if input or textarea has text in it (11.0.1+) #321

hudochenkov opened this issue Jun 8, 2020 · 5 comments · Fixed by #322
Labels

Comments

@hudochenkov
Copy link

  • @testing-library/user-event version: 11.2.1

  • Testing Framework and version:
    jest@26.0.1
    @testing-library/jest-dom@5.9.0
    @testing-library/react@10.2.1

  • 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.

@kentcdodds
Copy link
Member

@all-contributors please add @hudochenkov for bugs

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @hudochenkov! 🎉

@kentcdodds
Copy link
Member

Thank you!

@kentcdodds
Copy link
Member

🎉 This issue has been resolved in version 11.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@hudochenkov
Copy link
Author

This is incredible fast! Thank you very much, Kent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants