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

updata dependencies #23

Merged
merged 1 commit into from
Sep 30, 2017
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
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"
44 changes: 32 additions & 12 deletions demo/Select2Demo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Demo extends React.Component {
size={this.state.size}
allowClear
value={this.state.size}
style={{ width: 200 }}
style={{ width: '200px' }}
onChange={(size) => { this.setState({ size }); }}
>
<Option value="large">large</Option>
Expand All @@ -123,12 +123,13 @@ class Demo extends React.Component {
size={this.state.size}
placeholder="请选择"
notFoundContent=""
style={{ width: 200 }}
style={{ width: '200px' }}
onChange={me.handleChange.bind(me)}
allowClear
getPopupContainer={function () {
return document.getElementById('container');
}} dropdownClassName="kuma-select2-selected-has-icon"
}}
dropdownClassName="kuma-select2-selected-has-icon"
>
<Option value="jack">Jack</Option>
<Option value="lucy">LucyLucyLucyLucyLucyLucyLucyLucy</Option>
Expand All @@ -137,7 +138,12 @@ class Demo extends React.Component {
</Select>
<p>带搜索框:</p>
<Select
size={this.state.size} defaultValue="lucy" showSearch style={{ width: 200 }} searchPlaceholder="输入" onChange={me.handleChange.bind(me)}
size={this.state.size}
defaultValue="lucy"
showSearch
style={{ width: '200px' }}
searchPlaceholder="输入"
onChange={me.handleChange.bind(me)}
>
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>
Expand All @@ -146,7 +152,13 @@ class Demo extends React.Component {
</Select>
<p>多选:</p>
<Select
size={this.state.size} multiple style={{ width: 400 }} defaultValue={['a10', 'c12']} placeholder="输入" onChange={me.handleChange.bind(me)} allowClear
size={this.state.size}
multiple
style={{ width: '400px' }}
defaultValue={['a10', 'c12']}
placeholder="输入"
onChange={me.handleChange.bind(me)}
allowClear
>
{children}
</Select>
Expand All @@ -155,23 +167,27 @@ class Demo extends React.Component {
size={this.state.size}
multiple
filterOption={false}
style={{ width: 400 }}
style={{ width: '400px' }}
onSearch={me.handleSearch.bind(me)}
onChange={me.handleChange.bind(me)}
>
{ajaxOptions}
</Select>
<p>标签:(标签的意义是,用户可以通过键盘自己输入值,而不局限于传入的选项)</p>
<Select
size={this.state.size} style={{ width: '100%' }} searchPlaceholder="标签模式" tags onChange={me.handleChange.bind(me)}
size={this.state.size}
style={{ width: '100%' }}
searchPlaceholder="标签模式"
tags
onChange={me.handleChange.bind(me)}
>
{tagChildren}
</Select>
<p>智能提示</p>
<Select
size={this.state.size}
combobox
style={{ width: 200 }}
style={{ width: '200px' }}
onChange={this.handleMailChange.bind(this)}
filterOption={false}
searchPlaceholder="请输入账户名"
Expand All @@ -182,7 +198,7 @@ class Demo extends React.Component {
<Select
size={this.state.size}
defaultValue={provinceData[0]}
style={{ width: 150 }}
style={{ width: '150px' }}
onChange={this.handleProvinceChange.bind(this)}
>
{provinceOptions}
Expand All @@ -191,20 +207,24 @@ class Demo extends React.Component {
<Select
size={this.state.size}
value={this.state.secondCity}
style={{ width: 150 }}
style={{ width: '150px' }}
onChange={this.onSecondCityChange.bind(this)}
>
{cityOptions}
</Select>
<p>Combo 模式</p>
<Select
size={this.state.size} combobox
size={this.state.size}
combobox
>
{cityOptions}
</Select>
<p>禁用</p>
<Select
size={this.state.size} defaultValue="lucy" style={{ width: 200 }} disabled
size={this.state.size}
defaultValue="lucy"
style={{ width: '200px' }}
disabled
>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
Expand Down
103 changes: 53 additions & 50 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,54 @@
{
"name": "uxcore-select2",
"version": "0.4.19",
"description": "select ui component for react",
"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"
},
"repository": "https://github.com/uxcore/uxcore-select2.git",
"bugs": {
"url": "http://github.com/uxcore/select/issues"
},
"keywords": [
"react",
"react-pagination",
"react-select",
"select"
],
"devDependencies": {
"console-polyfill": "^0.2.2",
"enzyme": "^2.7.0",
"es5-shim": "^4.5.8",
"expect.js": "~0.3.1",
"jquery": "^1.12.4",
"kuma-base": "1.x",
"react": "0.14.x",
"react-addons-test-utils": "0.14.x",
"react-dom": "0.14.x",
"uxcore-kuma": "*",
"uxcore-tools": "0.2.x"
},
"dependencies": {
"classnames": "^2.1.2",
"rc-select": "~6.8.0"
},
"author": "",
"contributors": [],
"license": "MIT"
}
"name": "uxcore-select2",
"version": "0.4.19",
"description": "select ui component for react",
"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"
},
"repository": "https://github.com/uxcore/uxcore-select2.git",
"bugs": {
"url": "http://github.com/uxcore/select/issues"
},
"keywords": [
"react",
"react-pagination",
"react-select",
"select"
],
"devDependencies": {
"console-polyfill": "^0.2.3",
"enzyme": "^3.0.0",
"enzyme-adapter-react-15": "^1.0.0",
"es5-shim": "^4.5.9",
"expect.js": "^0.3.1",
"jquery": "^1.12.4",
"kuma-base": "^1.7.2",
"react": "^15.6.2",
"react-dom": "^15.6.2",
"react-test-renderer": "^15.6.2",
"uxcore-kuma": "^8.1.1",
"uxcore-tools": "0.2.x"
},
"dependencies": {
"classnames": "^2.2.5",
"prop-types": "^15.6.0",
"rc-select": "^6.9.3"
},
"author": "",
"contributors": [],
"license": "MIT"
}
3 changes: 2 additions & 1 deletion src/Select2.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import RcSelect from 'rc-select';
import classnames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';


class Select2 extends React.Component {
Expand All @@ -19,7 +20,7 @@ class Select2 extends React.Component {
}
Select2.displayName = 'Select2';
Select2.propTypes = {
size: React.PropTypes.oneOf(['large', 'middle', 'small']),
size: PropTypes.oneOf(['large', 'middle', 'small']),
};
Select2.defaultProps = {
size: 'large',
Expand Down
11 changes: 7 additions & 4 deletions tests/Select2.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import expect from 'expect.js';
import React from 'react';
import ReactDOM from 'react-dom';
import { mount } from 'enzyme';
import TestUtils, { Simulate } from 'react-addons-test-utils';
import Enzyme, { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import TestUtils, { Simulate } from 'react-dom/test-utils';
import Select2 from '../src';

Enzyme.configure({ adapter: new Adapter() });

describe('Select2', () => {
it('allows us to set props', () => {
const wrapper = mount(<Select2 prefixCls="kuma-select2" optionLabelProp="children" transitionName="slideUp" ></Select2>);
const wrapper = mount(<Select2 prefixCls="kuma-select2" optionLabelProp="children" transitionName="slideUp" />);
expect(wrapper.props().prefixCls).to.equal('kuma-select2');
wrapper.setProps({ prefixCls: 'kuma-select2-test' });
expect(wrapper.props().prefixCls).to.equal('kuma-select2-test');
Expand All @@ -20,4 +23,4 @@ describe('Select2', () => {
wrapper.setProps({ transitionName: 'slideUp-test' });
expect(wrapper.props().transitionName).to.equal('slideUp-test');
});
});
});
4 changes: 2 additions & 2 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
* only require other specs here
*/

const req = require.context('.', false, /\.spec\.js(x)?$/);
req.keys().forEach(req);
const req = require.context('.', false, /\.spec\.js(x)?$/);
req.keys().forEach(req);