Invalid value for prop `css` on <div> tag when running Jest
See original GitHub issueCurrent behavior: When running tests via Jest, I receive the following warning dozens of times in our output:
Warning: Invalid value for prop `css` on <div> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM. For details, see https://fb.me/react-attribute-behavior
in div (at DrawerLayout.js:59)
in DrawerContentGroup (at OrgIntegrationFacebookDrawer.js:38)
in div (at DrawerLayout.js:49)
in DrawerBody (at OrgIntegrationFacebookDrawer.js:36)
in div (at DrawerLayout.js:17)
in DrawerLayout (at OrgIntegrationFacebookDrawer.js:34)
in div (at DrawerComponent.js:21)
in div (created by ForwardRef(Paper))
in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper)))
in WithStyles(ForwardRef(Paper)) (created by Transition)
in Transition (created by ForwardRef(Slide))
in ForwardRef(Slide) (created by ForwardRef(Drawer))
in div (created by ForwardRef(Drawer))
in ForwardRef(Drawer) (created by WithStyles(ForwardRef(Drawer)))
in WithStyles(ForwardRef(Drawer)) (at DrawerComponent.js:13)
in DrawerComponent (at OrgIntegrationFacebookDrawer.js:33)
in OrgIntegrationFacebookDrawer (at OrgIntegrationFacebookDrawer.test.js:39)
in DrawerProvider (at OrgIntegrationFacebookDrawer.test.js:38)
To reproduce: The pertinent part of the code is here:
const DrawerLayout = ({ children, ...otherProps }) => (
<div css={styles} {...otherProps} data-testid="drawer-layout">
{children}
</div>
);
Expected behavior: I would expect that the CSS prop shouldn’t throw an Unknown Prop warning: https://reactjs.org/warnings/unknown-prop.html
Environment information:
react
version: 16.9.0react-dom
version: 16.9.0emotion-core
version: 10.0.27emotion
version: 10.0.27jest
version 23.6.0,jest-emotion
version 10.0.7a
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:16 (7 by maintainers)
Top Results From Across the Web
React: Invalid value for prop `savehere` on <div> tag. Either ...
React: Invalid value for prop `savehere` on <div> tag. Either remove it from the element, or pass a string or number value to...
Read more >Invalid value for prop `css` on <div> tag when running Jest -
When running tests via Jest, I receive the following warning dozens of times in our output: Warning: Invalid value for prop `css` on...
Read more >The css Prop - Emotion
The styles supplied to the css prop are evaluated and the computed class name is applied to the className prop.
Read more >React-Testing-Library — Pro tips. Extends expect of ... - Jero
In the following example, we will see how to simulate the change event in FavoriteNumber component. test('entering an invalid value shows an error...
Read more >FAQs - styled-components
npm install styled-components@^5.0.0 react@^16.8 react-dom@^16.8 ... Note regarding css @import and createGlobalStyle ... const Component = styled.div`.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My project has worked well with the following setup.
Environment information:
Well, this is really not a lot of information to debug this properly.
Please always try to share a repro case in a runnable form - either by providing a git repository to clone or a codesandbox. OSS maintainers usually can’t afford the time to set up the repro, even if exact steps are given.