-
Notifications
You must be signed in to change notification settings - Fork 399
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
toHaveStyle ignores hover styles #59
Comments
This is similar to #53, and I suspect that dom-testing-library's |
I honestly don't think there's anything that dom-testing-library could reasonably do for this. I don't know if dispatching these events via JavaScript APIs in the browser would actually update the CSS applied. That'd be the first thing to check. |
Yes, I think the same. It was not my intention to suggest that dom-testing-library should fix this. My point @davidcai is that |
This issue seems to be out of the scope of jest-dom, so I'm closing it. It can always be re-open if someone suggests an actionable path forward. |
It seems this issue isn't resolved with userEvent as well. userEvent.hover is triggering a hover action. But it looks like toHaveStyle is failing. As mentioned in the original issue, the test complained that the background color is still green instead of red. version details |
I am encountering the same issue.Any updates on that ? |
This is a limitation of a library below JSDOM - Long story short - the |
@theKashey Do you mean that it is impossible to test this scenario (where we have a component that has a div and a hidden button, when the user hover over the div, the button shows). I can test this scenario if I use |
Try bumping |
Thanks for your reply! I tried updating |
Look like the fix got reverted as long as it caused regression and hasn't been implemented back - dperini/nwsapi#80 |
Describe the feature you'd like:
I have a button that displays different styles when mouse moves over it:
Here is my test:
However, the test complained that the background color is still green instead of red.
I tried
fireEvent.mouseEnter
before callingmouseOver
. Didn't make any difference.I don't think it is
fireEvent.mouseOver
's problem. A onMouseOver event listener actually gets called when a mouseOver event is fired byfireEvent
. Could it be a bug in jest-dom?Describe alternatives you've considered:
So far, I commented out all test that verify hover styles. And I probably should leave this style test to visual/browser test?
The text was updated successfully, but these errors were encountered: