Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to test with React? createTextRange error #61

Closed
vctormb opened this issue Apr 3, 2019 · 4 comments
Closed

How to test with React? createTextRange error #61

vctormb opened this issue Apr 3, 2019 · 4 comments

Comments

@vctormb
Copy link

vctormb commented Apr 3, 2019

I'm trying to test the editor with Jest and React Testing Library, which uses jsdom.

When I run my test I receive the following error:
TypeError: doc.body.createTextRange is not a function

image

How can I fix it?

Also, is it possible to mock the skin and content css paths, because in the test I'm receiving the following error:
Error: Could not load link: "http://localhost/assets/skins/content/default/content.min.css"

image

@vctormb vctormb changed the title How to test with react? How to test with react? createTextRange error Apr 3, 2019
@vctormb vctormb changed the title How to test with react? createTextRange error How to test with React? createTextRange error Apr 3, 2019
@dkrefta
Copy link

dkrefta commented Apr 3, 2019

You can use https://www.cypress.io :D

@SimonFc
Copy link
Contributor

SimonFc commented Apr 5, 2019

I think the createTextRange it's failing on is from here. It seems like jsdom simply haven't implemented any of the methods. Looks like it's an open request though. Jsdom isn't anything that's officially supported by TinyMCE so I would expect that you would encounter more issues even if you would get past that one.

You can set the base_url in Tiny so this might be of help with your second issue. The issue is one related to your setup though and isn't anything I can say anything for certain about.

@vedran-passendo
Copy link

It is a shame that a product you are paying for (not a small amount) can not provide any way to be tested in React which is a requirement for any serious development team. Being forced to exclude tinyMCE components from test coverage is one way to solve it but I don't see why investing a couple of developer hours to make the library testable, to at least be able to input text and see if callbacks are executed, is a big deal for a company developing tinyMCE.

@nitinja
Copy link

nitinja commented Mar 13, 2024

@vedran-passendo
Agreed, had to exclude component that uses this lib from testing because of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants