Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: react v16 version support #306

Merged
merged 1 commit into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions docs/components/preview.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -125,4 +126,4 @@ class Preview extends Component {

}

export default Preview;
export default Preview;
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"
}
}
5 changes: 3 additions & 2 deletions src/components/flex/flex_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import PropTypes from 'prop-types';
*/
const FlexItem = (props) => {
const { component, children, ...others } = props;
const Component = component;
return (
<component className="weui-flex__item" {...others}>
<Component className="weui-flex__item" {...others}>
{ children }
</component>
</Component>
);
};

Expand Down
2 changes: 1 addition & 1 deletion test/actionsheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ describe('<ActionSheet></ActionSheet>', ()=> {
})
})

});
});
5 changes: 5 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--file ./test/setup.js
--require babel-core/register
--recursive
-r ignore-styles
-r jsdom-global/register
4 changes: 4 additions & 0 deletions test/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Enzyme.configure({ adapter: new Adapter() });
3 changes: 2 additions & 1 deletion test/uploader.js
Original file line number Diff line number Diff line change
@@ -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 = [
{
Expand Down