Skip to content

Remove character from behind using Backspace fireEvent doesn't work #680

@rohmanhm

Description

@rohmanhm
  • @testing-library/react version: ^10.0.4
  • Testing Framework and version: "jest": "^24.8.0"
  • DOM Environment: "@testing-library/jest-dom": "^5.7.0"

Relevant code or config:

input.focus()
const options = {
    key: 'Backspace',
    keyCode: 8,
    charCode: 8,
    which: 8,
}
fireEvent.keyPress(input, options) // Doesn't work
fireEvent.keyDown(input, options) // Doesn't work
fireEvent.keyUp(input, options) // Doesn't work

What you did:

I try to remove a character from behind using the Backspace event from keyboard but it didn't work as expected.

What happened:

It won't let me delete the character from behind using Backspace.

Reproduction:

https://codesandbox.io/s/testing-library-delete-1-character-i4y3d?file=/src/input.test.js:507-753

Problem description:

Suggested solution:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions