Skip to content

Commit 0905f0d

Browse files
committed
feat: react v16+ only support #307
1 parent d8b7432 commit 0905f0d

File tree

8 files changed

+35
-18
lines changed

8 files changed

+35
-18
lines changed

.travis.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
language: node_js
22
node_js:
3-
- "7"
3+
- "8"
4+
- "10"
5+
env:
6+
- REACT=16.x
47
script:
5-
- npm test
6-
- npm run coverage
8+
- npm test
9+
- npm run coverage
710
before_install:
8-
11+
- npm install
12+
- npm install react react-dom
913
after_script:
1014
npm install coveralls && nyc report --reporter=text-lcov | coveralls

docs/components/preview.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//original code by FormidableLabs
22
//https://github.com/FormidableLabs/component-playground/blob/master/src/components/preview.jsx
33

4-
import React, { Component, PropTypes } from "react";
4+
import React, { Component } from "react";
5+
import PropTypes from "prop-types";
56
import { render } from "react-dom";
67
import ReactDOMServer from "react-dom/server";
78
import { transform } from "babel-standalone";
@@ -125,4 +126,4 @@ class Preview extends Component {
125126

126127
}
127128

128-
export default Preview;
129+
export default Preview;

package.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"build": "node scripts/build.js -p",
1010
"lint": "eslint 'src/**/*.js'",
1111
"pretest": "npm run lint",
12-
"test": "mocha --compilers js:babel-core/register --recursive -r ignore-styles -r jsdom-global/register",
12+
"test": "mocha",
1313
"test:watch": "npm run test -- --watch",
14-
"coverage": "npm run lint & nyc --require babel-core/register mocha -r ignore-styles -r jsdom-global/register && nyc report --reporter=lcov",
14+
"coverage": "npm run lint & nyc --require babel-core/register mocha && nyc report --reporter=lcov",
1515
"postpublish": "gh-pages -d ./build/demo"
1616
},
1717
"repository": {
@@ -59,7 +59,8 @@
5959
"chalk": "^1.1.3",
6060
"codemirror": "^5.20.2",
6161
"css-loader": "^0.28.4",
62-
"enzyme": "^2.6.0",
62+
"enzyme": "^3.10.0",
63+
"enzyme-adapter-react-16": "^1.14.0",
6364
"eslint": "^3.17.1",
6465
"eslint-plugin-react": "^3.11.3",
6566
"extract-text-webpack-plugin": "^3.0.0",
@@ -77,14 +78,13 @@
7778
"less": "^2.7.2",
7879
"less-loader": "^4.0.5",
7980
"minimist": "^1.2.0",
80-
"mocha": "^2.3.4",
81+
"mocha": "^6.2.0",
8182
"nyc": "^9.0.1",
8283
"open-browser-webpack-plugin": "0.0.1",
8384
"postcss-loader": "^2.0.6",
8485
"raw-loader": "^0.5.1",
85-
"react-addons-test-utils": "^0.14.3 || ^15.0.0-0 || 15.x",
8686
"react-codemirror": "^0.2.6",
87-
"react-docgen": "^2.16.0",
87+
"react-docgen": "^3.0.0",
8888
"react-fontawesome": "^1.3.1",
8989
"react-remarkable": "^1.1.1",
9090
"react-router": "^4.1.1",
@@ -100,6 +100,7 @@
100100
"rollup-plugin-progress": "^0.2.1",
101101
"rollup-plugin-replace": "^1.1.1",
102102
"rollup-plugin-uglify": "^1.0.1",
103+
"semver": "^6.3.0",
103104
"sinon": "^1.17.2",
104105
"style-loader": "^0.13.0",
105106
"uglify-loader": "^1.2.0",
@@ -108,7 +109,7 @@
108109
"webpack-dev-server": "^2.5.1"
109110
},
110111
"peerDependencies": {
111-
"react": "0.14.x || ^15.0.0-0 || 15.x",
112-
"react-dom": "^0.14.x || ^15.0.0-0 || 15.x"
112+
"react": ">= 16.0.0",
113+
"react-dom": ">= 16.0.0"
113114
}
114115
}

src/components/flex/flex_item.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import PropTypes from 'prop-types';
99
*/
1010
const FlexItem = (props) => {
1111
const { component, children, ...others } = props;
12+
const Component = component;
1213
return (
13-
<component className="weui-flex__item" {...others}>
14+
<Component className="weui-flex__item" {...others}>
1415
{ children }
15-
</component>
16+
</Component>
1617
);
1718
};
1819

test/actionsheet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ describe('<ActionSheet></ActionSheet>', ()=> {
109109
})
110110
})
111111

112-
});
112+
});

test/mocha.opts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--file ./test/setup.js
2+
--require babel-core/register
3+
--recursive
4+
-r ignore-styles
5+
-r jsdom-global/register

test/setup.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Enzyme from 'enzyme';
2+
import Adapter from 'enzyme-adapter-react-16';
3+
4+
Enzyme.configure({ adapter: new Adapter() });

test/uploader.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import TestUtils from 'react-addons-test-utils';
3+
import TestUtils from 'react-dom/test-utils'
44
import { shallow } from 'enzyme';
55
import assert from 'assert';
66
import WeUI from '../src/index';
77
var jsdom = require('jsdom');
88

9+
910
const {Uploader, Icon} = WeUI;
1011
const files = [
1112
{

0 commit comments

Comments
 (0)