From 316e337009293e3532e524946294f691ce78ca69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E9=B8=A3?= Date: Tue, 10 Oct 2017 13:43:55 +0800 Subject: [PATCH] update react 15 --- .eslintignore | 4 ++++ .gitignore | 1 - .npmignore | 4 ++-- .travis.yml | 15 ++++++++++++--- package.json | 20 ++++++++++++-------- src/CascadeMultiModal.jsx | 29 +++++++++++++++-------------- src/CascadeMultiPanel.jsx | 27 ++++++++++++++------------- src/CascadeMultiSelect.jsx | 3 ++- 8 files changed, 61 insertions(+), 42 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..f1f88a0 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +demo/ +build/ +mock/ +dist/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6730e40..372e187 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,3 @@ spm_modules dist build assets/**/*.css -.vscode diff --git a/.npmignore b/.npmignore index 6531ca0..8eee222 100644 --- a/.npmignore +++ b/.npmignore @@ -20,10 +20,10 @@ Thumbs.db *.swp out/ .build +.happypack node_modules _site sea-modules spm_modules .cache -.happypack -dist +dist \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 6fc0e4a..5ed592e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,17 @@ language: node_js sudo: false +addons: + apt: + packages: + - xvfb + notification: email: - wsj7552715@hotmail.com node_js: -- 4.0.0 +- 6.9.0 before_install: - | @@ -17,6 +22,11 @@ before_install: exit fi phantomjs --version +install: + - export DISPLAY=':99.0' + - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + - npm install + script: - | @@ -25,7 +35,6 @@ script: else npm run $TEST_TYPE fi - env: matrix: - TEST_TYPE=test @@ -34,4 +43,4 @@ env: matrix: allow_failures: - - env: "TEST_TYPE=saucelabs" + - env: "TEST_TYPE=saucelabs" \ No newline at end of file diff --git a/package.json b/package.json index 4987ab0..fb20c2c 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,12 @@ "coverage": "uxcore-tools run coverage", "pub": "uxcore-tools run pub", "dep": "uxcore-tools run dep", - "update": "uxcore-tools run update", "tnpm-dep": "uxcore-tools run tnpm-dep", - "saucelabs": "uxcore-tools run saucelabs", "chrome": "uxcore-tools run chrome", - "browsers": "uxcore-tools run browsers" + "browsers": "uxcore-tools run browsers", + "saucelabs": "uxcore-tools run saucelabs", + "update": "uxcore-tools run update", + "tnpm-update": "uxcore-tools run tnpm-update" }, "bugs": { "url": "http://github.com/uxcore/uxcore-cascade-multi-select/issues" @@ -32,12 +33,14 @@ ], "devDependencies": { "console-polyfill": "^0.2.2", + "enzyme": "^3.0.0", + "enzyme-adapter-react-15": "^1.0.0", "es5-shim": "^4.5.8", "expect.js": "~0.3.1", "kuma-base": "1.x", - "react": "0.14.x", - "react-addons-test-utils": "0.14.x", - "react-dom": "0.14.x", + "react": "15.x", + "react-dom": "15.x", + "react-test-renderer": "15.x", "uxcore-cascade-select": "^0.3.3", "uxcore-kuma": "*", "uxcore-tools": "0.2.x" @@ -45,11 +48,12 @@ "dependencies": { "classnames": "^2.1.2", "lodash": "^4.17.4", + "object-assign": "^4.0.0", + "prop-types": "15.x", "uxcore-button": "^0.4.7", "uxcore-dialog": "^0.7.0", - "object-assign": "^4.0.0", "uxcore-dropdown": "^0.4.1" }, "contributors": [], "license": "MIT" -} +} \ No newline at end of file diff --git a/src/CascadeMultiModal.jsx b/src/CascadeMultiModal.jsx index d28ac55..21a0007 100644 --- a/src/CascadeMultiModal.jsx +++ b/src/CascadeMultiModal.jsx @@ -6,6 +6,7 @@ * All rights reserved. */ import React from 'react'; +import PropTypes from 'prop-types'; import classnames from 'classnames'; import deepcopy from 'lodash/cloneDeep'; import Button from 'uxcore-button'; @@ -279,21 +280,21 @@ CascadeMultiModal.defaultProps = { }; CascadeMultiModal.propTypes = { - className: React.PropTypes.string, - prefixCls: React.PropTypes.string, - config: React.PropTypes.array, - options: React.PropTypes.array, - cascadeSize: React.PropTypes.number, - value: React.PropTypes.array, - notFoundContent: React.PropTypes.string, - allowClear: React.PropTypes.bool, - locale: React.PropTypes.string, - onSelect: React.PropTypes.func, + className: PropTypes.string, + prefixCls: PropTypes.string, + config: PropTypes.array, + options: PropTypes.array, + cascadeSize: PropTypes.number, + value: PropTypes.array, + notFoundContent: PropTypes.string, + allowClear: PropTypes.bool, + locale: PropTypes.string, + onSelect: PropTypes.func, - title: React.PropTypes.string, - width: React.PropTypes.number, - onOk: React.PropTypes.func, - onCancel: React.PropTypes.func, + title: PropTypes.string, + width: PropTypes.number, + onOk: PropTypes.func, + onCancel: PropTypes.func, }; export default CascadeMultiModal; diff --git a/src/CascadeMultiPanel.jsx b/src/CascadeMultiPanel.jsx index 4f15061..9bd4681 100644 --- a/src/CascadeMultiPanel.jsx +++ b/src/CascadeMultiPanel.jsx @@ -8,6 +8,7 @@ import React from 'react'; import classnames from 'classnames'; import deepcopy from 'lodash/cloneDeep'; +import PropTypes from 'prop-types'; import i18n from './locale'; class CascadeMulti extends React.Component { @@ -595,7 +596,7 @@ class CascadeMulti extends React.Component { ; } else { // 21 = kuma-icon的占位宽度 - arr = ; + arr = ; } return arr; } @@ -649,18 +650,18 @@ CascadeMulti.defaultProps = { }; CascadeMulti.propTypes = { - className: React.PropTypes.string, - prefixCls: React.PropTypes.string, - config: React.PropTypes.array, - options: React.PropTypes.array, - cascadeSize: React.PropTypes.number, - value: React.PropTypes.array, - notFoundContent: React.PropTypes.string, - allowClear: React.PropTypes.bool, - locale: React.PropTypes.string, - onSelect: React.PropTypes.func, - onItemClick: React.PropTypes.func, - mode: React.PropTypes.oneOf(['independent', 'mix']), + className: PropTypes.string, + prefixCls: PropTypes.string, + config: PropTypes.array, + options: PropTypes.array, + cascadeSize: PropTypes.number, + value: PropTypes.array, + notFoundContent: PropTypes.string, + allowClear: PropTypes.bool, + locale: PropTypes.string, + onSelect: PropTypes.func, + onItemClick: PropTypes.func, + mode: PropTypes.oneOf(['independent', 'mix']), }; CascadeMulti.displayName = 'CascadeMulti'; diff --git a/src/CascadeMultiSelect.jsx b/src/CascadeMultiSelect.jsx index c3d79fa..c99d4a4 100644 --- a/src/CascadeMultiSelect.jsx +++ b/src/CascadeMultiSelect.jsx @@ -5,7 +5,8 @@ * Copyright 2015-2017, Uxcore Team, Alinw. * All rights reserved. */ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import classnames from 'classnames'; import Dropdown from 'uxcore-dropdown'; import Button from 'uxcore-button';