Open bedrich-schindler opened 5 months ago
The problem is in var()
values. For exact values it works as expected.
Because of missing support for var()
in testing environment, I have updated Grid.test.jsx
to compare styles using outerHTML.includes(<CSS>)
- the only way how to test it now.
It ready for review.
A mentioned guys from Spirit team for inspiration as their Modal is missing tests.
This is work-in-progress pull request!
I've replacedjsdom
withhappy-dom
testing environment and with little changes (typically because of use of incorrect jest functions ) andModal
tests with<dialog>
works almost as expected. But for some reason, there are 4 tests inGrid.test.jsx
that does not work. TBH, I don't know why.~~I debbuged test functions, respectively
toHaveStyle
which is part ofnode_modules/@testing-library/jest-dom/dist/matchers-342a062d.js
.toHaveStyle
internally usesisSubset
function`. I edited function to be able to debug it step-by-step:And for some reason, not all CSS properties are part of computed styles (variablev
) and that's the reason why the tests fails.Can anybody look at it? Can we discuss if this is the right way? Because withouthappy-dom
, we won't be able to test ourModal
component which is problem guys from LMC's Spirit Design System encountered. (cc @adamkudrna @crishpeen @literat).If we want to have Modal tested, we either skip those tests for rowGap and columnGap or we can test it different way, for example using.outerHTML.contains(<css>)
. It is not perfect nor good, but it works at least.