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

userEvent.type backspace does not work #564

Closed
lanmonster opened this issue Feb 23, 2021 · 1 comment
Closed

userEvent.type backspace does not work #564

lanmonster opened this issue Feb 23, 2021 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@lanmonster
Copy link

  • @testing-library/user-event version: "^12.1.10"
  • Testing Framework and version: it's a default CRA project and react-scripts is version 4.0.1. not sure what version of jest it uses...
  • DOM Environment: jsdom "@testing-library/jest-dom": "^5.11.4",

Relevant code or config

it('test', () => {
    render(<App />)

    userEvent.type(document.body, "{backspace}")

    //error
})

What you did: trying to test behavior when backspace is pressed

What happened: backspace event is not fired and there is an error saying "cannot read length of undefined"

image

Reproduction repository:

https://codesandbox.io/s/gracious-noyce-dso6z?file=/src/__tests__/test.js

Problem description: backspace event does not appear to fire

Suggested solution: 🤷

@ph-fritsche
Copy link
Member

Thanks for the report :)

Duplicate of #481 .

Will be fixed with #521, but I guess this will take some time.
Until then, you can not use userEvent.type to type on non-editable elements.

@nickserv nickserv added the duplicate This issue or pull request already exists label Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants