-
Notifications
You must be signed in to change notification settings - Fork 78
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
Question about enzyme/mocha tests #65
Comments
There are more issues with this :
|
What do we need to set on the parent wrapper in enzyme tests to get dimensions to pick-up a height and width value. Is there a way we can mock this out for testing purposes? |
Having similar issues as well with testing a library component that tries to measure wrapping parent dimensions, would be interested in knowing if this could be mocked? |
@jstoebel Don't know if it is still relevant, but you could mock it like this:
Though it is not a best option, since source code is getting polluted with tests-related stuff. |
I'm a little confused on how to write enzyme tests for a component that uses
react-dimensions
The component looks like this:
I'm trying to test it like this:
The above test fails with
AssertionError: expected { Object (component, root, ...) } to have a length of 1 but got 0
I looked at the value of
wrapper.html()
and get<div style="width: 100%; height: 100%; padding: 0px; border: 0px;">0</div>
. I believe this touches on #28, but as things work just fine in my browser I'm confused as to why it does not behave as I would expect in my tests. Any ideas? Is there any other code I can provide that would shed light on this situation? Thanks.The text was updated successfully, but these errors were encountered: