diff --git a/.travis.yml b/.travis.yml index f30ca26..532caaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,14 @@ language: node_js node_js: - - "7" + - "8" + - "10" +env: + - REACT=16.x script: - - npm test - - npm run coverage + - npm test + - npm run coverage before_install: - npm install --save react@15.4.0 react-dom@15.4.0 + - npm install + - npm install react react-dom after_script: npm install coveralls && nyc report --reporter=text-lcov | coveralls diff --git a/docs/components/preview.js b/docs/components/preview.js index 0f58152..3b902fe 100644 --- a/docs/components/preview.js +++ b/docs/components/preview.js @@ -1,7 +1,8 @@ //original code by FormidableLabs //https://github.com/FormidableLabs/component-playground/blob/master/src/components/preview.jsx -import React, { Component, PropTypes } from "react"; +import React, { Component } from "react"; +import PropTypes from "prop-types"; import { render } from "react-dom"; import ReactDOMServer from "react-dom/server"; import { transform } from "babel-standalone"; @@ -125,4 +126,4 @@ class Preview extends Component { } -export default Preview; \ No newline at end of file +export default Preview; diff --git a/package.json b/package.json index 8fb857e..0396027 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "build": "node scripts/build.js -p", "lint": "eslint 'src/**/*.js'", "pretest": "npm run lint", - "test": "mocha --compilers js:babel-core/register --recursive -r ignore-styles -r jsdom-global/register", + "test": "mocha", "test:watch": "npm run test -- --watch", - "coverage": "npm run lint & nyc --require babel-core/register mocha -r ignore-styles -r jsdom-global/register && nyc report --reporter=lcov", + "coverage": "npm run lint & nyc --require babel-core/register mocha && nyc report --reporter=lcov", "postpublish": "gh-pages -d ./build/demo" }, "repository": { @@ -59,7 +59,8 @@ "chalk": "^1.1.3", "codemirror": "^5.20.2", "css-loader": "^0.28.4", - "enzyme": "^2.6.0", + "enzyme": "^3.10.0", + "enzyme-adapter-react-16": "^1.14.0", "eslint": "^3.17.1", "eslint-plugin-react": "^3.11.3", "extract-text-webpack-plugin": "^3.0.0", @@ -77,14 +78,13 @@ "less": "^2.7.2", "less-loader": "^4.0.5", "minimist": "^1.2.0", - "mocha": "^2.3.4", + "mocha": "^6.2.0", "nyc": "^9.0.1", "open-browser-webpack-plugin": "0.0.1", "postcss-loader": "^2.0.6", "raw-loader": "^0.5.1", - "react-addons-test-utils": "^0.14.3 || ^15.0.0-0 || 15.x", "react-codemirror": "^0.2.6", - "react-docgen": "^2.16.0", + "react-docgen": "^3.0.0", "react-fontawesome": "^1.3.1", "react-remarkable": "^1.1.1", "react-router": "^4.1.1", @@ -100,6 +100,7 @@ "rollup-plugin-progress": "^0.2.1", "rollup-plugin-replace": "^1.1.1", "rollup-plugin-uglify": "^1.0.1", + "semver": "^6.3.0", "sinon": "^1.17.2", "style-loader": "^0.13.0", "uglify-loader": "^1.2.0", @@ -108,7 +109,7 @@ "webpack-dev-server": "^2.5.1" }, "peerDependencies": { - "react": "0.14.x || ^15.0.0-0 || 15.x", - "react-dom": "^0.14.x || ^15.0.0-0 || 15.x" + "react": ">= 16.0.0", + "react-dom": ">= 16.0.0" } } diff --git a/src/components/flex/flex_item.js b/src/components/flex/flex_item.js index cf2d6f2..d579d4d 100644 --- a/src/components/flex/flex_item.js +++ b/src/components/flex/flex_item.js @@ -9,10 +9,11 @@ import PropTypes from 'prop-types'; */ const FlexItem = (props) => { const { component, children, ...others } = props; + const Component = component; return ( - + { children } - + ); }; diff --git a/test/actionsheet.js b/test/actionsheet.js index 5bca2fc..10cdfea 100644 --- a/test/actionsheet.js +++ b/test/actionsheet.js @@ -109,4 +109,4 @@ describe('', ()=> { }) }) -}); \ No newline at end of file +}); diff --git a/test/mocha.opts b/test/mocha.opts new file mode 100644 index 0000000..1fb658f --- /dev/null +++ b/test/mocha.opts @@ -0,0 +1,5 @@ +--file ./test/setup.js +--require babel-core/register +--recursive +-r ignore-styles +-r jsdom-global/register diff --git a/test/setup.js b/test/setup.js new file mode 100644 index 0000000..fc7b0dc --- /dev/null +++ b/test/setup.js @@ -0,0 +1,4 @@ +import Enzyme from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; + +Enzyme.configure({ adapter: new Adapter() }); diff --git a/test/uploader.js b/test/uploader.js index 8c923b7..62f3e1c 100644 --- a/test/uploader.js +++ b/test/uploader.js @@ -1,11 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import TestUtils from 'react-addons-test-utils'; +import TestUtils from 'react-dom/test-utils' import { shallow } from 'enzyme'; import assert from 'assert'; import WeUI from '../src/index'; var jsdom = require('jsdom'); + const {Uploader, Icon} = WeUI; const files = [ {