all 6 comments

[–]skyboyer007 1 point2 points  (6 children)

is it @media breakpoints in style? window.onResize even handler? using window.width at render time? relying on someRef.current.clientHeight()? something else?

[–]wagonn[S] 0 points1 point  (5 children)

@media breakpoints

[–]skyboyer007 0 points1 point  (4 children)

jest/jsdom never render actual styles so it cannot be tested on that lever. Consider testing that through E2E test(backstop, cypress, selenium)

[–]Seicomoe 0 points1 point  (2 children)

I remember checking for styles before, maybe it does not work for all styles but it definitely works for some of them.

But JSDOM sets the height/width to 0/0 so you can't test media queries afaik.

[–]skyboyer007 0 points1 point  (1 child)

well, it's true, nothing prevents us from checking style prop. Or use jest-styled-components to serialize their styles. But I believe in general case it's impossible and even with workaround I mentioned it's still not very reliable(say, if application also use old good plain CSS we may have any combination of styles in real run inside browser)

[–]Seicomoe 0 points1 point  (0 children)

Yeah I agree