-
Notifications
You must be signed in to change notification settings - Fork 98
[Tests] use enzyme-adapter-react-helper; test on multiple react versions #118
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
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why convert to class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -59,7 +61,7 @@ describe('withStyles()', () => { | |||
return null; | |||
} | |||
|
|||
const WrappedComponent = withStyles(() => ({}))(MyComponent); | |||
const WrappedComponent = withStyles(() => ({}))(safeSFC(MyComponent)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-helper
to handle both configuring enzyme, as well as ensuring the proper react version is installed.Based on react-dates/react-dates#846