Merge pull request #5758 from STRML/test-react-constant-elements-unreferenced-param

Add regression test for transform-react-constant-elements (#5552)
This commit is contained in:
Brian Ng 2017-05-21 13:38:52 -05:00 committed by GitHub
commit c6eab0c206
3 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,16 @@
import React from 'react';
// Regression test for https://github.com/babel/babel/issues/5552
class BugReport extends React.Component {
thisWontWork = ({ color }) => (data) => {
return <div color={ color }>does not reference data</div>;
};
thisWorks = ({ color }) => (data) => {
return <div color={ color }>{ data }</div>;
};
render() {
return <div />
}
}

View File

@ -0,0 +1,21 @@
import React from 'react';
// Regression test for https://github.com/babel/babel/issues/5552
var _ref = <div />;
class BugReport extends React.Component {
constructor(...args) {
var _temp;
return _temp = super(...args), this.thisWontWork = ({ color }) => data => {
return <div color={color}>does not reference data</div>;
}, this.thisWorks = ({ color }) => data => {
return <div color={color}>{data}</div>;
}, _temp;
}
render() {
return _ref;
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": ["transform-class-properties", "transform-react-constant-elements", "syntax-jsx"]
}