However, toHaveCompiledCss doesn't know how to determine that body &:hover matches the el component. We should either extend toHaveCompiledCss to support this use case, or give an explicit error telling developers that this is not supported.
(Perhaps leaning towards the latter, as we want to discourage people from using nested / complicated selectors as part of the UI Styling Standard)
toHaveCompiledCss
supports checking if a pseudo-selector has certain styles applied: https://compiledcssinjs.com/docs/pkg-jest#pseudo-selectorsWith that in mind, we expect this Jest code to work:
However,
toHaveCompiledCss
doesn't know how to determine thatbody &:hover
matches theel
component. We should either extendtoHaveCompiledCss
to support this use case, or give an explicit error telling developers that this is not supported.(Perhaps leaning towards the latter, as we want to discourage people from using nested / complicated selectors as part of the UI Styling Standard)