diff --git a/.travis.yml b/.travis.yml index 4a9b761..1671088 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: node_js node_js: - - "stable" + - stable script: - - npm test \ No newline at end of file + - npm test + - npm run coverage +after_script: + npm install coveralls && cat ./coverage/lcov.info | coveralls \ No newline at end of file diff --git a/README.md b/README.md index f411b3e..fd6a5c9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -WeUI 为微信Web服务量身设计 [![Build Status](https://travis-ci.org/weui/react-weui.svg?branch=master)](https://travis-ci.org/weui/react-weui) [![npm version](https://img.shields.io/npm/v/react-weui.svg)](https://www.npmjs.org/package/react-weui) +WeUI 为微信Web服务量身设计 [![Build Status](https://travis-ci.org/weui/react-weui.svg?branch=master)](https://travis-ci.org/weui/react-weui) [![npm version](https://img.shields.io/npm/v/react-weui.svg)](https://www.npmjs.org/package/react-weui) [![Coverage Status](https://coveralls.io/repos/github/weui/react-weui/badge.svg?branch=master)](https://coveralls.io/github/weui/react-weui?branch=master) ==== diff --git a/docs/cell.md b/docs/cell.md index 161cf15..38d46a0 100644 --- a/docs/cell.md +++ b/docs/cell.md @@ -10,7 +10,6 @@ 属性名|类型|默认值|可选值|备注 ------|----|------|------|----| access|bool|false | true, false| 控制Cell是否显示小箭头以及点击的Active态 -form |bool|false | true, false| 当Cell内有表单元素时使用 #### CellsTitle @@ -100,4 +99,4 @@ body{ text-overflow: ellipsis; } } -``` \ No newline at end of file +``` diff --git a/example/component/page.less b/example/component/page.less index 91b19aa..65b7f46 100644 --- a/example/component/page.less +++ b/example/component/page.less @@ -25,8 +25,10 @@ body{ padding: 0 15px; } } -} -.page.cell .bd { - padding-bottom: 30px; -} \ No newline at end of file + &.cell{ + .bd{ + padding-bottom: 15px; + } + } +} diff --git a/example/pages/cell/index.js b/example/pages/cell/index.js index 6b96a6b..c3a88c4 100644 --- a/example/pages/cell/index.js +++ b/example/pages/cell/index.js @@ -164,10 +164,12 @@ export default class CellDemo extends React.Component { 文本域
- + + +
); } -}; \ No newline at end of file +}; diff --git a/src/components/cell/cells.js b/src/components/cell/cells.js index e0b50a8..2f1fe60 100644 --- a/src/components/cell/cells.js +++ b/src/components/cell/cells.js @@ -8,12 +8,23 @@ import React from 'react'; import classNames from 'classnames'; export default class Cells extends React.Component { + static propTypes = { + access: React.PropTypes.bool, + radio: React.PropTypes.bool, + checkbox: React.PropTypes.bool + }; + + static defaultProps = { + access: false, + radio: false, + checkbox: false + }; + render() { - const {children, className, access, radio, checkbox, form, ...others} = this.props; + const {children, className, access, radio, checkbox, ...others} = this.props; const cls = classNames({ weui_cells: true, weui_cells_access: access, - weui_cells_form: form, [className]: className }); @@ -21,4 +32,4 @@ export default class Cells extends React.Component {
{children}
); } -}; \ No newline at end of file +}; diff --git a/src/components/form/textarea.js b/src/components/form/textarea.js index 7cdf041..581f966 100644 --- a/src/components/form/textarea.js +++ b/src/components/form/textarea.js @@ -3,18 +3,16 @@ */ - import React, { Component, PropTypes } from 'react'; -import CellBody from '../cell/cell_body'; import classNames from 'classnames'; export default class TextArea extends React.Component { static propTypes = { - showCounter: PropTypes.bool, + showCounter: PropTypes.bool }; static defaultProps = { - showCounter: true, + showCounter: true }; state = { @@ -22,12 +20,13 @@ export default class TextArea extends React.Component { }; handleChange(e){ - this.setState({textCounter: e.target.value.length}); - //forward event to props if any - if(this.props.onChange) this.props.onChange(e); + this.setState({textCounter: e.target.value.length}); + + //forward event to props if any + if(this.props.onChange) this.props.onChange(e); } - render() { + render(){ const { className, children, showCounter, maxlength, ...others } = this.props; const cls = classNames({ weui_textarea: true, @@ -35,10 +34,12 @@ export default class TextArea extends React.Component { }); return ( - - - {showCounter ?
{this.state.textCounter}/{maxlength ? maxlength : '∞'}
: false} -
+
+ + {showCounter ?
+ {this.state.textCounter}{maxlength ? '/' + maxlength : false}
: false} +
); } }; diff --git a/src/components/input/input.js b/src/components/input/input.js index b2bc197..b1daf37 100644 --- a/src/components/input/input.js +++ b/src/components/input/input.js @@ -17,14 +17,14 @@ export default class Input extends React.Component { }; render() { - const { className, defaultValue, ...others } = this.props; + const { className, ...others } = this.props; const cls = classNames({ weui_input: true, [className]: className }); return ( - + ); } };