[Tests] use enzyme-adapter-react-helper; test on multiple react versions#118
[Tests] use enzyme-adapter-react-helper; test on multiple react versions#118ljharb wants to merge 5 commits intoairbnb:masterfrom
Conversation
19967ed to
6896359
Compare
f0e1acc to
b54a658
Compare
test/withStyles_test.jsx
Outdated
| function MyComponent() { | ||
| return null; | ||
| class MyComponent extends React.Component { | ||
| render() { |
There was a problem hiding this comment.
SFCs don't work in React 0.13, and I was hoping to make the tests pass on it (only one fails rn)
There was a problem hiding this comment.
Although actually I think I have a cleaner solution that will let us use SFCs inline, and reduce these diffs; i'll get that up in a few days.
There was a problem hiding this comment.
Posted enzymejs/enzyme#1383; once merged and released, I'll use it here. The diff is much much smaller.
b54a658 to
a780c3a
Compare
3b432a2 to
a29bc5b
Compare
| } | ||
|
|
||
| const WrappedComponent = withStyles(() => ({}))(MyComponent); | ||
| const WrappedComponent = withStyles(() => ({}))(safeSFC(MyComponent)); |
There was a problem hiding this comment.
I think this is an interesting solution, but I think it actually makes the tests less readable. My preference would be to not include this at all, and just not run tests against React 0.13.
|
@ljharb Are you still interested in landing this change? |
|
Yep - I'm planning on adding a feature to enzyme (after the react work is done) that applies safeSFC inside the react 13 adapter, so that all this boilerplate can vanish. |
This uses
enzyme-adapter-react-helperto handle both configuring enzyme, as well as ensuring the proper react version is installed.Based on react-dates/react-dates#846