Full DOM rendering test fails at react-quill component.
See original GitHub issueI’m using react-quill
component in my app. Everything works fine except tests. I was writing some unit tests for my components. When I test my App component to simply render the app (using Enzyme’s mount method), it fails rendering Quill component. Here is output:
Error: Uncaught [ReferenceError: MutationObserver is not defined]
console.error node_modules/react-dom/cjs/react-dom.development.js:15123
The above error occurred in the <Quill> component:
in Quill (at board.js:64)
in div (at board.js:63)
in div (at board.js:62)
in div (at board.js:49)
in Board (created by WrappedBoard)
in span (created by WrappedBoard)
in div (created by WrappedBoard)
in WrappedBoard (at app.js:19)
in div (at app.js:17)
in div (at app.js:16)
in div (at app.js:14)
React-Quill version
1.3.2
To reproduce:
- Set up React app using create-react-app
- Add
react-quill
component - Use
react-quill
component somewhere in your app - Add
enzyme
to your app - Write a unit test like this one:
import React from 'react';
import { mount } from 'enzyme';
import App from '../App';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
it('renders without crashing', () => {
mount(<App />);
});
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:14
Top Results From Across the Web
Full DOM rendering test fails at react-quill component.
I'm using react-quill component in my app. Everything works fine except tests. I was writing some unit tests for my components.
Read more >reactjs - Jest tests not passing even though component seems ...
I am trying to understand why the tests are failing. Failing Tests. App.test.js import React from 'react'; import ...
Read more >react-quill-fixed - npm
The Quill rich-text editor as a React component. ... Start using react-quill-fixed in your project by running `npm i react-quill-fixed`.
Read more >Build a WYSIWYG text editor using Quill - LogRocket Blog
`npm i react-quill`. Once the installation is complete, open the App.js file, import the ReactQuill component, and include it into the App ...
Read more >cannot read properties of null (reading 'usecontext') jest
Store isn't a React component so it can't use the useStore hook. ... I removed react-dom as one of my dependencies and it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi! I am using Jest and I have setupTests.js file where I put global mocks. This code helped me with the same problem…
@lyctw I realize this was awhile ago but did you end up finding a solution for when you have a custom toolbar? I’m also receiving the error of the
classList
beingnull
.