yahoo / jsx-test

An easy way to test your React Components (`.jsx` files).
Other
27 stars 17 forks source link

Add/with context helper #2

Closed ZeikJT closed 9 years ago

ZeikJT commented 9 years ago

@3den

React@0.13 has a deprecation warning for React.withContext so I added a helper to make using mock contexts easier in testing. This will be especially useful in the future when React.withContext is completely removed.

Enables testing contexts by simply doing:

jsx.assertRender(jsx.withContext(mockContext, MyReactComponent), props, expected);
3den commented 9 years ago

We should add some tests for this new feature, thanks for the PR :)

ZeikJT commented 9 years ago

@3den Fixed all comments, let me know if there's anything else that needs changing

3den commented 9 years ago

@ZeikJT there is just 1 small suggestion to simplify the assert