1
votes

I need to test a component inside a Panel.

The main issue is that a panel is rendered outside of the react root element when it's opened. When I mount my component the content of the panel is not displayed in the mount. I found that the content is outside of react. I'm able to access the content using the document but I want to leverage Jest/Enzyme to simulateClick, spyOn and so on...

How can I test elements inside the Panel using Jest/Enzyme?

1

1 Answers

0
votes

Try to use jsdom in order to get the document or window.

import jsdom from 'jsdom'
const doc = jsdom.jsdom('<!doctype html><html><body></body></html>')
global.document = doc
global.window = doc.defaultView
...