I have issue with react testing library. I write a test case for a modal window open on editor and then close to fire closed event. but on image button click but it does not show the open class as rendered modal in test after click. seems like it find the element before it loads all the classes. here is the link of editor redactor editor You can see it just removed the open class on closing modal window. In my case i never get opened class in my test render component. Below is my test case
it('should open image modal and close ', async () => {
render(<Editor id='test-modal' initValue={props.initValue} />)
jest.setTimeout(30000)
const imageButton = screen.getByLabelText('Image')
userEvent.click(imageButton.firstChild)
await waitFor(() => {
const imageModal = screen.queryByText('Image')
screen.debug(imageModal.parentNode.parentNode)
}, { timeout: 4000 })
// expect(imageModal).toBeInTheDocument()
// const closeButton = imageModal.previousSibling
// // userEvent.click(closeButton)
// screen.debug(closeButton.parentNode.parentNode)
expect(imageButton.parentNode.parentNode).toHaveClass('redactor-animate-hide1')
})