Skip to content
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

Run create-element-to-jsx Codemod #961

Merged
merged 5 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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