slate icon indicating copy to clipboard operation
slate copied to clipboard

onChange is not called when used with userEvent.type from React testing library

Open giorgosera opened this issue 1 year ago • 2 comments

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:

  1. Go to 'tests/index.js'
  2. Run the tests
  3. 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

giorgosera avatar May 14 '23 19:05 giorgosera

facing the same issue.

LakshayDutta avatar Sep 19 '23 07:09 LakshayDutta

Moreover, the actual text didn't change

image

boar-is avatar Dec 10 '23 15:12 boar-is