Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add ReactTestUtils to react-tools (main.js) and document it #560
For anybody running across this issue, @spicyj pointed me at http://myshareoftech.com/2013/12/unit-testing-react-dot-js-with-jasmine-and-karma.html , which includes information for shipping a vendored version of react with test utils, but also uses constructs like
expect(label.refs.p).toBeDefined(); expect(label.refs.p.props.children).toBe("Some Text We Need for Test")
to inspect react component state, which was the necessary piece for me.
I have written a library called jasmine-react which I use to test react components: https://github.com/tommyh/jasmine-react.
it allows you todo things like:
repost of info I put in reactjs freenode: in the long run, I might try to merge some of my features into https://github.com/facebook/react/blob/master/src/test/ReactTestUtils.js and #560. but for right now, jasmine-react works out of the box w/ no custom grunt build needed