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

does this work with react-test-renderer AND react-addons-test-utils ? #6

Open
faceyspacey opened this issue Mar 2, 2017 · 0 comments

Comments

@faceyspacey
Copy link

faceyspacey commented Mar 2, 2017

I.e. does it work with the component tree's meant for serialization/snapshots:

import renderer from 'react-test-renderer'
import { querySelectorAll } from 'bill'

const tree = renderer.create(<div />).toJSON()
const matches = querySelectorAll('div', tree)
import ReactTestUtils from 'react-addons-test-utils'
import { querySelectorAll } from 'bill'

const renderer = ReactTestUtils.createRenderer()
renderer.render(<div />)

const tree = renderer.getRenderOutput()
const matches = querySelectorAll('div', tree)

The reason I ask is because you may have already created a component instance with renderer.create() which continues to stay reactively "alive" responding to state changes, and then you want to traverse its component tree, not the original component tree you first passed to renderer.create().

I'd like to add *Bill` to this library of mine:

https://github.com/faceyspacey/jest-redux-snap

So, for example, will bill be able to work with renderer.create(<div />).toJSON()?

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

1 participant