From e921de87732f32f077a37ffd477336da40fabe1d Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Fri, 16 Jun 2017 09:45:06 -0300 Subject: [PATCH] [fixed] use the correct babel presets combination. --- .babelrc | 20 +------------------- package.json | 5 ++--- specs/Modal.spec.js | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/.babelrc b/.babelrc index 3ea63de0..e68d2fea 100644 --- a/.babelrc +++ b/.babelrc @@ -1,21 +1,3 @@ { - "presets": ["react"], - "env": { - "commonjs": { - "plugins": [ - "transform-class-properties", - "transform-object-rest-spread" - ], - "presets": ["env"] - }, - "es": { - "plugins": [ - "transform-class-properties", - "transform-object-rest-spread" - ], - "presets": [ - ["env", { "modules": false }] - ] - } - } + "presets": ["es2015", "stage-2", "react"] } diff --git a/package.json b/package.json index a33d20ca..14a5a43b 100644 --- a/package.json +++ b/package.json @@ -32,10 +32,9 @@ "babel-core": "^6.25.0", "babel-eslint": "^7.1.1", "babel-loader": "^6.2.4", - "babel-plugin-transform-class-properties": "^6.24.1", - "babel-plugin-transform-object-rest-spread": "^6.23.0", - "babel-preset-env": "^1.5.2", + "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", + "babel-preset-stage-2": "^6.24.1", "codeclimate-test-reporter": "^0.4.0", "coveralls": "^2.13.1", "cross-env": "^5.0.1", diff --git a/specs/Modal.spec.js b/specs/Modal.spec.js index 451223ae..f4c160dc 100644 --- a/specs/Modal.spec.js +++ b/specs/Modal.spec.js @@ -3,7 +3,6 @@ import expect from 'expect'; import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import TestUtils from 'react-addons-test-utils'; -import createReactClass from 'create-react-class'; import Modal from '../src/components/Modal'; import * as ariaAppHider from '../src/helpers/ariaAppHider'; import { @@ -57,7 +56,7 @@ describe('State', () => { it('renders into the body, not in context', () => { const node = document.createElement('div'); - const App = createReactClass({ + class App extends Component { render() { return (
@@ -67,7 +66,7 @@ describe('State', () => {
); } - }); + } Modal.setAppElement(node); ReactDOM.render(, node); expect( @@ -357,10 +356,11 @@ describe('State', () => { const node = document.createElement('div'); let modal = null; - const App = createReactClass({ - getInitialState() { - return { testHasChanged: false }; - }, + class App extends Component { + constructor(props) { + super(props); + this.state = { testHasChanged: false }; + } componentDidMount() { expect(modal.node.className).toEqual('myPortalClass'); @@ -368,11 +368,11 @@ describe('State', () => { this.setState({ testHasChanged: true }); - }, + } componentDidUpdate() { expect(modal.node.className).toEqual('myPortalClass-modifier'); - }, + } render() { const portalClassName = this.state.testHasChanged === true ? @@ -389,7 +389,7 @@ describe('State', () => { ); } - }); + } Modal.setAppElement(node); ReactDOM.render(, node);