Open ncesar opened 4 years ago
i am also experiencing this even after using container.firstChild
Somehow i start getting this error after i renamed component and test file, renamed to kebab-case.
I'm also getting this after renaming my Component, I had to switch back to get it work :/
SAME
This makes sense now. jest-styled-components
isn't compatible with react-testing-library
. If you want to test if an element has a style on it:
it('should have flex', () => {
expect(component).toHaveStyle({
display: 'flex',
});
});
worked for me after adding and configuring.
If I create a styled component with a color of black, and then, when using the component, if I pass a conditional inline style,
toHaveStyleRule
will detect only the first color.If I use
debug
, in the DOM the component has the correct inline style, but not in the test.