-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
TypeError: w.default.findDOMNode is not a function #876
Comments
Comment by jasonmorganson In [email protected] This looks like the place to pass it in: https://github.com/storybooks/storyshots/blob/master/src/test_runner/snapshot_runner.js#L60 Still need a good way to pass the mock into the story though. Maybe something like: function createNodeMock (element) {
if (element.type === 'p') {
return {};
}
return null;
}
const options = {createNodeMock}
storiesOf('Foo', module)
.add('default state', () => (
<Foo />
), options) For that to work Then line 60 could pass the node mock in: const {createNodeMock} = story.options
const renderer = ReactTestRenderer.create(tree, createNodeMock) |
I made PR on the old storyshots repo that resolve this issue: storybook-eol/storyshots#98 |
It's now possible to set a (admittedly global) Obviously people will probably want to do it per-test, which is probably better described by the dupe issue #881. Let's have the discussion there, closing this. |
Hey guys, I'm having the same problem but I'm stuck with the old version:
Do you have any suggestions? |
Hmm, I don't really think there's any way to get around it in the old storyshots. You could do something hacky like monkey patch |
@tmeasday thanks for the tip!! It seems that my problem is related to jsdom: |
I've solved it by patching |
Issue by ericclemmons
Tuesday Nov 29, 2016 at 20:49 GMT
Originally opened as storybook-eol/storyshots#58
When testing with , I get the following error for anything wrapped by a
@componentQueries
(which uses https://github.com/ctrlplusb/react-sizeme):I assume that I need to mock the DOM node somehow?
Has anyone else had issues with testing out DOM-dependent components like this?
The text was updated successfully, but these errors were encountered: