Skip to content

Commit

Permalink
Merge 1185c76 into 80da0f6
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaofan10 authored Oct 20, 2017
2 parents 80da0f6 + 1185c76 commit 63970cc
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 76 deletions.
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"
9 changes: 5 additions & 4 deletions demo/CrumbDemo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
* Copyright 2014-2015, Uxcore Team, Alinw.
* All rights reserved.
*/
const React = require('react');
const Crumb = require('../src');
import React from 'react';

import Crumb from '../src/Crumb';


class Demo extends React.Component {
Expand All @@ -17,7 +18,7 @@ class Demo extends React.Component {
render() {
return (
<Crumb
ref="crumb"
ref={(c) => { this.crumb = c; }}
className="crumb-style crumb-root"
>
<Crumb.Item href="#" className="crumb-item-style" disabled>首页</Crumb.Item>
Expand All @@ -29,4 +30,4 @@ class Demo extends React.Component {
}
}

module.exports = Demo;
export default Demo;
7 changes: 4 additions & 3 deletions demo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* All rights reserved.
*/

const React = require('react');
const ReactDOM = require('react-dom');
const Demo = require('./CrumbDemo');
import React from 'react';

import ReactDOM from 'react-dom';
import Demo from './CrumbDemo';

ReactDOM.render(<Demo />, document.getElementById('UXCoreDemo'));
3 changes: 1 addition & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,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>
106 changes: 54 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,56 @@
{
"name": "uxcore-crumb",
"version": "0.2.3",
"description": "crumb-uxcore component for uxcore.",
"repository": "https://github.com/uxcore/uxcore-crumb.git",
"author": "peijie.dpj",
"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-crumb/issues"
},
"keywords": [
"react",
"react-component",
"uxcore-crumb",
"Crumb",
""
],
"devDependencies": {
"console-polyfill": "^0.2.2",
"enzyme": "^2.7.1",
"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",
"sinon": "^1.17.7",
"uxcore-crumb-item": "~0.1.3",
"uxcore-kuma": "*",
"uxcore-tools": "0.2.x"
},
"dependencies": {
"classnames": "^2.1.2",
"object-assign": "^4.0.0",
"uxcore-crumb-item": "~0.1.3"
},
"contributors": [],
"license": "MIT"
"name": "uxcore-crumb",
"version": "0.2.3",
"description": "crumb-uxcore component for uxcore.",
"repository": "https://github.com/uxcore/uxcore-crumb.git",
"author": "peijie.dpj",
"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-crumb/issues"
},
"keywords": [
"react",
"react-component",
"uxcore-crumb",
"Crumb",
""
],
"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-crumb-item": "~0.1.3",
"uxcore-kuma": "*",
"uxcore-tools": "0.2.x"
},
"dependencies": {
"classnames": "^2.1.2",
"object-assign": "^4.0.0",
"prop-types": "15.x",
"uxcore-crumb-item": "~0.1.3"
},
"contributors": [],
"license": "MIT"
}
14 changes: 8 additions & 6 deletions src/Crumb.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
* All rights reserved.
*/

const CrumbItem = require('uxcore-crumb-item');
const classnames = require('classnames');
const React = require('react');
import CrumbItem from 'uxcore-crumb-item';

import classnames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';

class Crumb extends React.Component {

Expand Down Expand Up @@ -40,16 +42,16 @@ Crumb.propTypes = {
* @title 类名前缀
* @veIgnore
*/
prefixCls: React.PropTypes.string,
prefixCls: PropTypes.string,
/**
* @title CSS类名
* @veIgnore
*/
className: React.PropTypes.string,
className: PropTypes.string,
};

Crumb.Item = CrumbItem;

Crumb.displayName = 'Crumb';

module.exports = Crumb;
export default Crumb;
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
* All rights reserved.
*/

module.exports = require('./Crumb');
export default from './Crumb';
14 changes: 9 additions & 5 deletions tests/Crumb.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import expect from 'expect.js';
import React from 'react';
import { mount } from 'enzyme';
import Crumb from '../src';
import Enzyme, { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import Crumb from '../src/Crumb';

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

describe('Crumb', () => {
it('render correct', () => {
Expand All @@ -14,12 +17,13 @@ describe('Props', () => {

it('className support', () => {
wrapper = mount(<Crumb className="test" />);
expect(wrapper.component.getDOMNode().className).to.be('kuma-uxcrumbs test');
window.wrapper = wrapper;
expect(wrapper.getDOMNode().className).to.be('kuma-uxcrumbs test');
});

it('prefixCls support', () => {
wrapper = mount(<Crumb prefixCls="test" />);
expect(wrapper.component.getDOMNode().className).to.be('test');
expect(wrapper.getDOMNode().className).to.be('test');
});
});

Expand Down Expand Up @@ -67,6 +71,6 @@ describe('Children', () => {
<Crumb>
<Crumb.Item className="children-classname-disabled" disabled>disabled</Crumb.Item>
</Crumb>);
expect(wrapper.find('[disabled]')).to.have.length(1);
expect(wrapper.find('[disabled]').hostNodes()).to.have.length(1);
});
});

0 comments on commit 63970cc

Please sign in to comment.