froala / react-froala-wysiwyg

React component for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
565 stars 131 forks source link

Error with React testing library #341

Open aguiar-tiago opened 2 years ago

aguiar-tiago commented 2 years ago

Hi, I tried different approaches to get this working in RTL but it doesn't seem to work. Looks like the Editor is never mounted when in testing. Right now I'm calling the editorRef?.current?.editor.html.insert function from a custom button (editorRef is the useRef for the Editor Component), but I always get this error 👇 TypeError: Cannot read property 'split' of undefined Is this project ready to work on RTL? If so, do you have any examples to show me the proper direction? Thanks in advance!

leotankilevich commented 9 months ago

Hey! This issue is still important

leotankilevich commented 9 months ago

@aguiar-tiago Try to add jest.mock('froala-editor'); to your spec/test file `