-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to jest mock the size #193
Comments
add this modal to your mocks folder const sizeMeProps = { const sizeMe = (options) => (Component) => { export const SizeMe = (props) => { export default sizeMe;` |
I'm using TypeScript and did the following. My Props interface extended the Then I defined the size props in
Then simply spread them into my component when rendering in the test:
|
We put react-sizeme.js in the
|
Are there any examples on how to mock the size for jest tests?
I'm using the sizeMe()(MyComponent) and expecting the size to come in as a prop. I've tried mocking the getBoundingClientRect but the size.width is still returning undefined.
The text was updated successfully, but these errors were encountered: