Skip to content

Commit

Permalink
Merge pull request #1 from diasbruno/fix/compilation
Browse files Browse the repository at this point in the history
Fix compilation.
  • Loading branch information
fuller committed Jun 16, 2017
2 parents 965a2c3 + 2fc1382 commit a3e0332
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 42 deletions.
20 changes: 1 addition & 19 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -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"]
}
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ docs: build-docs

# Rules for build and publish

build:
compile:
@echo "[Compiling source]"
babel src --out-dir lib

build: compile
@echo "[Building dists]"
@./node_modules/.bin/webpack --config webpack.dist.config.js

Expand Down Expand Up @@ -120,5 +124,8 @@ publish-docs: deps-docs build-docs

publish-all: publish publish-docs

clean:
clean-sources:
@rm -rf lib/* dist/* _book

clean: clean-sources
@rm -rf .version .branch ./coverage/*
15 changes: 4 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"version": "2.0.0",
"description": "Accessible modal dialog component for React.JS",
"main": "./lib/index.js",
"module": "./es/index.js",
"jsnext:main": "./es/index.js",
"repository": {
"type": "git",
"url": "https://github.com/reactjs/react-modal.git"
Expand All @@ -16,12 +14,8 @@
},
"scripts": {
"start": "./node_modules/.bin/webpack-dev-server --inline --host 127.0.0.1 --content-base examples/",
"test": "cross-env BABEL_ENV=commonjs NODE_ENV=test karma start",
"lint": "eslint lib/",
"clean": "rimraf lib es",
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"build": "npm run clean && npm run build:commonjs && npm run build:es"
"test": "cross-env NODE_ENV=test karma start",
"lint": "eslint lib/"
},
"authors": [
"Ryan Florence"
Expand All @@ -32,10 +26,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",
Expand Down
20 changes: 10 additions & 10 deletions specs/Modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 (
<div>
Expand All @@ -67,7 +66,7 @@ describe('State', () => {
</div>
);
}
});
}
Modal.setAppElement(node);
ReactDOM.render(<App />, node);
expect(
Expand Down Expand Up @@ -357,22 +356,23 @@ 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');

this.setState({
testHasChanged: true
});
},
}

componentDidUpdate() {
expect(modal.node.className).toEqual('myPortalClass-modifier');
},
}

render() {
const portalClassName = this.state.testHasChanged === true ?
Expand All @@ -389,7 +389,7 @@ describe('State', () => {
</div>
);
}
});
}

Modal.setAppElement(node);
ReactDOM.render(<App />, node);
Expand Down

0 comments on commit a3e0332

Please sign in to comment.