Skip to content

Commit

Permalink
upgrade react to 15.x
Browse files Browse the repository at this point in the history
  • Loading branch information
buzhou committed Oct 28, 2017
1 parent 509ca58 commit 4cc41ed
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 62 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ spm_modules
.happypack
dist
build
coverage
package-lock.json
assets/**/*.css
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
- |
Expand All @@ -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:
- |
Expand All @@ -25,7 +35,6 @@ script:
else
npm run $TEST_TYPE
fi
env:
matrix:
- TEST_TYPE=test
Expand All @@ -34,4 +43,4 @@ env:

matrix:
allow_failures:
- env: "TEST_TYPE=saucelabs"
- env: "TEST_TYPE=saucelabs"
14 changes: 7 additions & 7 deletions demo/PopoverDemo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ class Demo extends React.Component {
return (
<div>
<h2>Demo 1. 悬浮弹出</h2>
<div style={{ marginLeft: 300, marginTop: 100 }}>
<div style={{ marginLeft: 60 }}>
<div style={{ marginLeft: '300px', marginTop: '100px' }}>
<div style={{ marginLeft: '60px' }}>
<Popover placement="topLeft" title={'上左'} overlay={overlay} onOk={test}>
<Button>上左</Button>
</Popover>
<Popover placement="top" title={'上边'} overlay={overlay}>
<Button>上边</Button>
<Button style="margin-left:10px;">上边</Button>
</Popover>
<Popover placement="topRight" title={'上右'} overlay={overlay}>
<Button>上右</Button>
<Button style="margin-left:10px;">上右</Button>
</Popover>
</div>
<div style={{ width: 60, float: 'left' }}>
<div style={{ width: '60px', float: 'left' }}>
<Popover placement="leftTop" title={'左上'} overlay={overlay}>
<Button>左上</Button>
</Popover>
Expand All @@ -77,7 +77,7 @@ class Demo extends React.Component {
<Button>左下</Button>
</Popover>
</div>
<div style={{ width: 60, marginLeft: 270 }}>
<div style={{ width: '60px', marginLeft: '270px' }}>
<Popover placement="rightTop" title={'右上'} overlay={overlay}>
<Button>右上</Button>
</Popover>
Expand All @@ -88,7 +88,7 @@ class Demo extends React.Component {
<Button>右下</Button>
</Popover>
</div>
<div style={{ marginLeft: 60, clear: 'both' }}>
<div style={{ marginLeft: '60px', clear: 'both' }}>
<Popover placement="bottomLeft" title={'下左'} overlay={overlay}>
<Button>下左</Button>
</Popover>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<script src="./node_modules/es5-shim/es5-shim.min.js"></script>
<script src="./node_modules/es5-shim/es5-sham.min.js"></script>
<script src="./node_modules/react/dist/react-with-addons.js"></script>
<script src="http://g.alicdn.com/uxcore/uxcore-lib/react/0.14.0/react-dom.js"></script>
<script src="./node_modules/react-dom/dist/react-dom.js"></script>
<script src="./dist/demo.js"></script>
</body>
</html>
104 changes: 54 additions & 50 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,56 @@
{
"name": "uxcore-popover",
"version": "0.5.2",
"description": "uxcore-popover component for uxcore.",
"repository": "https://github.com/uxcore/uxcore-popover.git",
"author": "eternalsky",
"main": "build/index.js",
"scripts": {
"start": "uxcore-tools run start",
"server": "uxcore-tools run server",
"lint": "uxcore-tools run lint",
"build": "uxcore-tools run build",
"test": "uxcore-tools run test",
"coverage": "uxcore-tools run coverage",
"pub": "uxcore-tools run pub",
"dep": "uxcore-tools run dep",
"tnpm-dep": "uxcore-tools run tnpm-dep",
"chrome": "uxcore-tools run chrome",
"browsers": "uxcore-tools run browsers",
"saucelabs": "uxcore-tools run saucelabs",
"update": "uxcore-tools run update"
},
"bugs": {
"url": "http://github.com/uxcore/uxcore-popover/issues"
},
"keywords": [
"react",
"react-component",
"uxcore-popover",
"Popover",
""
],
"devDependencies": {
"console-polyfill": "^0.2.2",
"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",
"uxcore-kuma": "2.x",
"uxcore-tools": "0.2.x"
},
"dependencies": {
"classnames": "^2.1.2",
"object-assign": "^4.0.0",
"rc-tooltip": "~3.3.0",
"uxcore-button": "~0.3.0"
},
"contributors": [],
"license": "MIT"
"name": "uxcore-popover",
"version": "0.5.3",
"description": "uxcore-popover component for uxcore.",
"repository": "https://github.com/uxcore/uxcore-popover.git",
"author": "eternalsky",
"main": "build/index.js",
"scripts": {
"start": "uxcore-tools run start",
"server": "uxcore-tools run server",
"lint": "uxcore-tools run lint",
"build": "uxcore-tools run build",
"test": "uxcore-tools run test",
"coverage": "uxcore-tools run coverage",
"pub": "uxcore-tools run pub",
"dep": "uxcore-tools run dep",
"tnpm-dep": "uxcore-tools run tnpm-dep",
"chrome": "uxcore-tools run chrome",
"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-popover/issues"
},
"keywords": [
"react",
"react-component",
"uxcore-popover",
"Popover",
""
],
"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": "15.x",
"react-dom": "15.x",
"react-test-renderer": "15.x",
"uxcore-kuma": "*",
"uxcore-tools": "0.2.x"
},
"dependencies": {
"classnames": "^2.1.2",
"object-assign": "^4.0.0",
"prop-types": "15.x",
"rc-tooltip": "~3.3.0",
"uxcore-button": "~0.3.0"
},
"contributors": [],
"license": "MIT"
}
52 changes: 51 additions & 1 deletion tests/Popover.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
import expect from 'expect.js';
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils, { Simulate } from 'react-addons-test-utils';
import TestUtils, { Simulate } from 'react-dom/test-utils';
import Popover from '../src';

describe('Popover', () => {
it('Could be rendered with overlay', function () {
const overlay = (<div>
<div className="demoContent">
<span>目标删除后将不可恢复,如有子目标将会删除!</span>
</div>
</div>);
const component = TestUtils.renderIntoDocument(
<Popover placement="right" title={'右边'} overlay={overlay}>
<span>右边</span>
</Popover>
);
});

it('Could be rendered without and without visiable', function () {
const component = TestUtils.renderIntoDocument(
<Popover
placement="right"
title={'右边'}
prefixCls="unit-test"
showButton={true}
>
<span className="overlay-inner-text">右边</span>
</Popover>
);
component.handleVisibleChange(true);
});

it('Could be rendered with visiable false', function () {
const props = {
placement: 'right',
title: '右边',
prefixCls: 'unit-test',
showButton: true,
visible: false
};
const component = TestUtils.renderIntoDocument(
<Popover
{...props}
>
<span className="overlay-inner-text">右边</span>
</Popover>
);
component.handleVisibleChange(true);
component.handleOkClick();
component.handleCancelClick();
component.componentWillReceiveProps({
...props,
visible: true
});
});

});

0 comments on commit 4cc41ed

Please sign in to comment.