Skip to content

Commit e921de8

Browse files
committedJun 16, 2017
[fixed] use the correct babel presets combination.
1 parent 92ccf1d commit e921de8

File tree

3 files changed

+13
-32
lines changed

3 files changed

+13
-32
lines changed
 

‎.babelrc

+1-19
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
11
{
2-
"presets": ["react"],
3-
"env": {
4-
"commonjs": {
5-
"plugins": [
6-
"transform-class-properties",
7-
"transform-object-rest-spread"
8-
],
9-
"presets": ["env"]
10-
},
11-
"es": {
12-
"plugins": [
13-
"transform-class-properties",
14-
"transform-object-rest-spread"
15-
],
16-
"presets": [
17-
["env", { "modules": false }]
18-
]
19-
}
20-
}
2+
"presets": ["es2015", "stage-2", "react"]
213
}

‎package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@
3232
"babel-core": "^6.25.0",
3333
"babel-eslint": "^7.1.1",
3434
"babel-loader": "^6.2.4",
35-
"babel-plugin-transform-class-properties": "^6.24.1",
36-
"babel-plugin-transform-object-rest-spread": "^6.23.0",
37-
"babel-preset-env": "^1.5.2",
35+
"babel-preset-es2015": "^6.24.1",
3836
"babel-preset-react": "^6.24.1",
37+
"babel-preset-stage-2": "^6.24.1",
3938
"codeclimate-test-reporter": "^0.4.0",
4039
"coveralls": "^2.13.1",
4140
"cross-env": "^5.0.1",

‎specs/Modal.spec.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import expect from 'expect';
33
import React, { Component } from 'react';
44
import ReactDOM from 'react-dom';
55
import TestUtils from 'react-addons-test-utils';
6-
import createReactClass from 'create-react-class';
76
import Modal from '../src/components/Modal';
87
import * as ariaAppHider from '../src/helpers/ariaAppHider';
98
import {
@@ -57,7 +56,7 @@ describe('State', () => {
5756

5857
it('renders into the body, not in context', () => {
5958
const node = document.createElement('div');
60-
const App = createReactClass({
59+
class App extends Component {
6160
render() {
6261
return (
6362
<div>
@@ -67,7 +66,7 @@ describe('State', () => {
6766
</div>
6867
);
6968
}
70-
});
69+
}
7170
Modal.setAppElement(node);
7271
ReactDOM.render(<App />, node);
7372
expect(
@@ -357,22 +356,23 @@ describe('State', () => {
357356
const node = document.createElement('div');
358357
let modal = null;
359358

360-
const App = createReactClass({
361-
getInitialState() {
362-
return { testHasChanged: false };
363-
},
359+
class App extends Component {
360+
constructor(props) {
361+
super(props);
362+
this.state = { testHasChanged: false };
363+
}
364364

365365
componentDidMount() {
366366
expect(modal.node.className).toEqual('myPortalClass');
367367

368368
this.setState({
369369
testHasChanged: true
370370
});
371-
},
371+
}
372372

373373
componentDidUpdate() {
374374
expect(modal.node.className).toEqual('myPortalClass-modifier');
375-
},
375+
}
376376

377377
render() {
378378
const portalClassName = this.state.testHasChanged === true ?
@@ -389,7 +389,7 @@ describe('State', () => {
389389
</div>
390390
);
391391
}
392-
});
392+
}
393393

394394
Modal.setAppElement(node);
395395
ReactDOM.render(<App />, node);

0 commit comments

Comments
 (0)
Please sign in to comment.