Skip to content
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

Cannot test with storyshots due to findDomNode #275

Closed
justin808 opened this issue Feb 19, 2017 · 6 comments
Closed

Cannot test with storyshots due to findDomNode #275

justin808 opened this issue Feb 19, 2017 · 6 comments

Comments

@justin808
Copy link

Summary: We cannot use storyshots with react-datetime

We are using: https://github.com/storybooks/storyshots for testing.

Per this issue:
facebook/react#7371 (comment)

and per this code:

https://github.com/YouCanBookMe/react-datetime/blob/5c617dcc7f23f667761b26fb4565d5f33d44dea7/src/onClickOutside.js#L58

   }(React.findDOMNode(this), this.handleClickOutside));

This fails with this obscure error:

Storyshots › DateTimePicker › All defaults (input is true by default)

    Invariant Violation: getNodeFromInstance: Invalid argument.

      at invariant (node_modules/fbjs/lib/invariant.js:44:15)
      at Object.getNodeFromInstance (node_modules/react-dom/lib/ReactDOMComponentTree.js:162:77)
      at Object.findDOMNode (node_modules/react-dom/lib/findDOMNode.js:49:41)
      at componentDidMount (node_modules/react-datetime/src/onClickOutside.js:58:12)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:265:25
      at measureLifeCyclePerf (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:75:12)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:264:11
      at CallbackQueue.notifyAll (node_modules/react-test-renderer/lib/CallbackQueue.js:76:22)
      at ReactTestReconcileTransaction.close (node_modules/react-test-renderer/lib/ReactTestReconcileTransaction.js:36:26)
      at ReactTestReconcileTransaction.closeAll (node_modules/react-test-renderer/lib/Transaction.js:206:25)
      at ReactTestReconcileTransaction.perform (node_modules/react-test-renderer/lib/Transaction.js:153:16)
      at batchedMountComponentIntoNode (node_modules/react-test-renderer/lib/ReactTestMount.js:69:27)
      at ReactDefaultBatchingStrategyTransaction.perform (node_modules/react-test-renderer/lib/Transaction.js:140:20)
      at Object.batchedUpdates (node_modules/react-test-renderer/lib/ReactDefaultBatchingStrategy.js:62:26)
      at Object.batchedUpdates (node_modules/react-test-renderer/lib/ReactUpdates.js:97:27)
      at Object.render (node_modules/react-test-renderer/lib/ReactTestMount.js:125:18)
      at Object.<anonymous> (node_modules/storyshots/dist/index.js:113:56)
@jiayuan6311
Copy link

+1, we met the same issue

@simeg
Copy link
Collaborator

simeg commented Apr 25, 2017

@justin808 @jiayuan6311 Are you using the latest version? I know the dependency for handling that got replaced, maybe it will resolve your problem.

The code that is causing the problem lives in a differente repo: https://github.com/Pomax/react-onclickoutside

@jiayuan6311
Copy link

jiayuan6311 commented Apr 25, 2017

@simeg We are on the latest version but the problem still persists. The problem is with ReactDOM.findDOMNode. It is still in the latest react-onclickoutside(Link).
Is there any way to work around this?

@simeg
Copy link
Collaborator

simeg commented Apr 25, 2017

@jiayuan6311 As react-onclickoutside is a library this component depends on, I don't see any way around this unfortunately :/

@layneanderson
Copy link
Collaborator

@justin808 , @jiayuan6311 Would a solution similar to what @simeg found for #384 work in this situation too?

@simeg
Copy link
Collaborator

simeg commented Jan 28, 2018

Closing due to inactivity.

@simeg simeg closed this as completed Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants