Skip to content

Commit

Permalink
Run create-element-to-jsx Codemod (uber#961)
Browse files Browse the repository at this point in the history
* Run the `create-element-to-jsx` codemod
  • Loading branch information
ayarcohaila committed Oct 15, 2018
1 parent 298c89b commit 7a4ad3f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion showcase/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ export default class App extends Component {
const el = document.createElement('div');
document.body.appendChild(el);

ReactDOM.render(React.createElement(App), el);
ReactDOM.render(<App />, el);
5 changes: 4 additions & 1 deletion showcase/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ const entry = {app: './app'};
const jsRule = {
test: /\.js$/,
loader: 'babel-loader',
exclude: [/node_modules/]
exclude: [/node_modules/],
query: {
presets: ['react', 'es2015', 'stage-0']
}
};
const isProd = process.env.NODE_ENV === 'production'; // eslint-disable-line
const config = isProd
Expand Down
31 changes: 15 additions & 16 deletions tests/utils/series-utils-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ import HorizontalBarSeries from 'plot/series/horizontal-rect-series';
import VerticalBarSeries from 'plot/series/vertical-rect-series';

test('series-utils #isSeriesChild', t => {
const series = React.createElement(LineSeries, {data: []});
const series = <LineSeries data={[]} />;
t.ok(isSeriesChild(series), 'Should return true for series');
const axis = React.createElement(XAxis, {
xRange: [0, 1],
xDomain: [0, 1],
xType: 'linear',
width: 100,
height: 100,
top: 0,
left: 0
});
const axis = <XAxis
xRange={[0, 1]}
xDomain={[0, 1]}
xType="linear"
width={100}
height={100}
top={0}
left={0} />;
t.notOk(isSeriesChild(axis), 'Should return false for non-series');
t.end();
});
Expand Down Expand Up @@ -81,8 +80,8 @@ const arePropsValid = seriesProps => {

test('series-utils #collectSeriesTypesInfo', t => {
const result = getSeriesPropsFromChildren([
React.createElement(LineSeries, {data: []}),
React.createElement(LineSeries, {data: []})
<LineSeries data={[]} />,
<LineSeries data={[]} />
]);
t.ok(result.length === 2, 'Returns array of proper size');
result.forEach((props, i) =>
Expand All @@ -93,10 +92,10 @@ test('series-utils #collectSeriesTypesInfo', t => {

test('series-utils #seriesClusterProps', t => {
const result = getSeriesPropsFromChildren([
React.createElement(HorizontalBarSeries, {cluster: 'alpha', data: []}),
React.createElement(HorizontalBarSeries, {cluster: 'beta', data: []}),
React.createElement(HorizontalBarSeries, {cluster: 'alpha', data: []}),
React.createElement(HorizontalBarSeries, {cluster: 'gamma', data: []})
<HorizontalBarSeries cluster="alpha" data={[]} />,
<HorizontalBarSeries cluster="beta" data={[]} />,
<HorizontalBarSeries cluster="alpha" data={[]} />,
<HorizontalBarSeries cluster="gamma" data={[]} />
]);
const expectedClusters = ['alpha', 'beta', 'gamma'];
t.ok(result.length === 4, 'Returns array of proper size');
Expand Down

0 comments on commit 7a4ad3f

Please sign in to comment.