slate
slate copied to clipboard
onChange is not called when used with userEvent.type from React testing library
Description
I am using RTL with Jest to test a Slate editor. I use .type
to emulate a user typing into the editor and expect that Slate's onChange
will be called. However, this does not happen.
Sandbox
Here's the sandbox where I reproduced the issue.
Steps To reproduce the behavior:
- Go to 'tests/index.js'
- Run the tests
- There is an assertion that the onChange was called but it fails
Expectation
I expected that the onChange will be called. This behavior only happens when tests are ran. In a normal browser onChange is indeed called.
Environment
- Slate Version: 0.91.4
facing the same issue.
Moreover, the actual text didn't change