You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for taking such a long time before answering.
The reason for why testing-library doesn't return the dialog element is because it is computed as display: none when it's closed. However, it seems like Happy DOM returned display: none when it was open as well.
I have made a fix for the issue in Happy DOM.
You will also have to update your code to <dialog open></dialog> in order for testing-library to consider it as accessible.
Describe the bug
Using version 6.0.4 of happy-dom, I test my component by utilising the
getByRole('dialog')
method.When updating to version 7.0.0 (or above) my tests fail on the dialog element with the error statement:
If I change
<dialog>...</dialog>
to<div role="dialog">...</div>
, the tests succeed once again.getByRole('dialog', { hidden: true })
also makes the test succeed, but is not preferred as this means the dialog element is not accessible.To Reproduce
Steps to reproduce the behavior:
yarn vitest
yarn install
yarn vitest
Expected behavior
I would expect that the test keeps succeeding, as the dialog element has been supported (and to my knowledge not updated) since 5.4.0?
The text was updated successfully, but these errors were encountered: