mwood23 / slate-test-utils

A toolkit to test Slate rich text editors with Jest, React Testing Library, and hyperscript! Write user driven integration tests with ease.
MIT License
57 stars 6 forks source link

Image test #8

Open newtmex opened 2 years ago

newtmex commented 2 years ago

Hi, first I like the way I can test snapshots with this framework.

How can I test user interaction involving adding image to the editor being tested?

mwood23 commented 2 years ago

Images should work just like any other node since the testing library checks the the structure of the Slate children. You could also snapshot the html markup but that's also just checking an image tag.

If you create me a repo with an issue you're seeing with images I'm happy to give it a look!

newtmex commented 2 years ago

Thanks for the reply @mwood23. My use case is thus: Just like the type helper, I want to simulate a user interaction such as insertImage on the editor (maybe through drag and drop) then run some tests on the editor.

Is this possible? If so, how can I achieve this?