From a09719af7b36acbcfc3dc2d134796f97b5d62e9e Mon Sep 17 00:00:00 2001 From: progrape Date: Mon, 25 Apr 2016 14:12:10 +0800 Subject: [PATCH] =?UTF-8?q?#68=20Cell*=20=E5=A2=9E=E5=8A=A0=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=BC=A0=E5=85=A5=E8=87=AA=E5=AE=9A=E4=B9=89=20classN?= =?UTF-8?q?ame?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cell/cell_body.js | 9 +++++---- src/components/cell/cell_footer.js | 9 +++++---- src/components/cell/cell_header.js | 9 +++++---- src/components/cell/cells_tips.js | 9 +++++---- src/components/cell/cells_title.js | 9 +++++---- test/cell_body.js | 7 ++++++- test/cell_footer.js | 7 ++++++- test/cell_header.js | 7 ++++++- test/cells_tips.js | 7 ++++++- test/cells_title.js | 7 ++++++- 10 files changed, 55 insertions(+), 25 deletions(-) diff --git a/src/components/cell/cell_body.js b/src/components/cell/cell_body.js index 992cf54..00f0c9f 100644 --- a/src/components/cell/cell_body.js +++ b/src/components/cell/cell_body.js @@ -9,14 +9,15 @@ import classNames from 'classnames'; export default class CellBody extends React.Component { render() { - const {children, ...others} = this.props; - const className = classNames({ + const {className, children, ...others} = this.props; + const cls = classNames({ weui_cell_bd: true, - weui_cell_primary: true + weui_cell_primary: true, + [className]: className }); return ( -
{children}
+
{children}
); } }; \ No newline at end of file diff --git a/src/components/cell/cell_footer.js b/src/components/cell/cell_footer.js index bf73906..cec399c 100644 --- a/src/components/cell/cell_footer.js +++ b/src/components/cell/cell_footer.js @@ -9,13 +9,14 @@ import classNames from 'classnames'; export default class CellFooter extends React.Component { render() { - const {children, ...others} = this.props; - const className = classNames({ - weui_cell_ft: true + const {className, children, ...others} = this.props; + const cls = classNames({ + weui_cell_ft: true, + [className]: className }); return ( -
{children}
+
{children}
); } }; \ No newline at end of file diff --git a/src/components/cell/cell_header.js b/src/components/cell/cell_header.js index 172fb3a..a8fd1a3 100644 --- a/src/components/cell/cell_header.js +++ b/src/components/cell/cell_header.js @@ -9,13 +9,14 @@ import classNames from 'classnames'; export default class CellHeader extends React.Component { render() { - const {children, ...others} = this.props; - const className = classNames({ - weui_cell_hd: true + const {className, children, ...others} = this.props; + const cls = classNames({ + weui_cell_hd: true, + [className]: className }); return ( -
{children}
+
{children}
); } }; \ No newline at end of file diff --git a/src/components/cell/cells_tips.js b/src/components/cell/cells_tips.js index c656e7d..3954073 100644 --- a/src/components/cell/cells_tips.js +++ b/src/components/cell/cells_tips.js @@ -9,13 +9,14 @@ import classNames from 'classnames'; export default class CellsTips extends React.Component { render() { - const {children, ...others} = this.props; - const className = classNames({ - weui_cells_tips: true + const {className, children, ...others} = this.props; + const cls = classNames({ + weui_cells_tips: true, + [className]: className }); return ( -
{children}
+
{children}
); } }; \ No newline at end of file diff --git a/src/components/cell/cells_title.js b/src/components/cell/cells_title.js index 42be8b9..d5a8c19 100644 --- a/src/components/cell/cells_title.js +++ b/src/components/cell/cells_title.js @@ -9,13 +9,14 @@ import classNames from 'classnames'; export default class CellsTitle extends React.Component { render() { - const {children, ...others} = this.props; - const className = classNames({ - weui_cells_title: true + const {className, children, ...others} = this.props; + const cls = classNames({ + weui_cells_title: true, + [className]: className }); return ( -
{children}
+
{children}
); } }; \ No newline at end of file diff --git a/test/cell_body.js b/test/cell_body.js index c4f402c..c137735 100644 --- a/test/cell_body.js +++ b/test/cell_body.js @@ -15,8 +15,9 @@ describe('', ()=> { ['cell body wording', ,

文章标题

文章描述

].map((child)=>{ describe(`${child}`, ()=>{ + const customClassName = 'customClassName1 customClassName2'; const wrapper = shallow( - {child} + {child} ); it(`should render component `, ()=>{ @@ -27,6 +28,10 @@ describe('', ()=> { assert(wrapper.hasClass(`weui_cell_bd`)); }); + it(`should have custom class name ${customClassName}`, ()=> { + assert(wrapper.hasClass(customClassName)); + }); + it(`should have child ${child}`, ()=>{ assert(wrapper.contains(child)); }); diff --git a/test/cell_footer.js b/test/cell_footer.js index ab7422b..06f7985 100644 --- a/test/cell_footer.js +++ b/test/cell_footer.js @@ -15,8 +15,9 @@ describe('', ()=> { ['cell footer wording', ].map((child)=>{ describe(`${child}`, ()=>{ + const customClassName = 'customClassName1 customClassName2'; const wrapper = shallow( - {child} + {child} ); it(`should render component `, ()=>{ @@ -27,6 +28,10 @@ describe('', ()=> { assert(wrapper.hasClass(`weui_cell_ft`)); }); + it(`should have custom class name ${customClassName}`, ()=> { + assert(wrapper.hasClass(customClassName)); + }); + it(`should have child ${child}`, ()=>{ assert(wrapper.contains(child)); }); diff --git a/test/cell_header.js b/test/cell_header.js index 3502d11..1d250e2 100644 --- a/test/cell_header.js +++ b/test/cell_header.js @@ -15,8 +15,9 @@ describe('', ()=> { ['cell header wording', ,

cell header wording

].map((child)=>{ describe(`${child}`, ()=>{ + const customClassName = 'customClassName1 customClassName2'; const wrapper = shallow( - {child} + {child} ); it(`should render component `, ()=>{ @@ -27,6 +28,10 @@ describe('', ()=> { assert(wrapper.hasClass(`weui_cell_hd`)); }); + it(`should have custom class name ${customClassName}`, ()=> { + assert(wrapper.hasClass(customClassName)); + }); + it(`should have child ${child}`, ()=>{ assert(wrapper.contains(child)); }); diff --git a/test/cells_tips.js b/test/cells_tips.js index ed0823a..759318b 100644 --- a/test/cells_tips.js +++ b/test/cells_tips.js @@ -14,8 +14,9 @@ const {CellsTips} = WeUI; describe('', ()=> { const text = `cells tips wording`; + const customClassName = 'customClassName1 customClassName2'; const wrapper = shallow( - {text} + {text} ); it(`should render component `, ()=>{ @@ -26,6 +27,10 @@ describe('', ()=> { assert(wrapper.hasClass(`weui_cells_tips`)); }); + it(`should have custom class name ${customClassName}`, ()=> { + assert(wrapper.hasClass(customClassName)); + }); + it(`should have text ${text}`, ()=>{ assert(wrapper.text() === text); }); diff --git a/test/cells_title.js b/test/cells_title.js index d90f04b..cf4cdbe 100644 --- a/test/cells_title.js +++ b/test/cells_title.js @@ -14,8 +14,9 @@ const {CellsTitle} = WeUI; describe('', ()=> { const text = `cells tips wording`; + const customClassName = 'customClassName1 customClassName2'; const wrapper = shallow( - {text} + {text} ); it(`should render component `, ()=>{ @@ -26,6 +27,10 @@ describe('', ()=> { assert(wrapper.hasClass(`weui_cells_title`)); }); + it(`should have custom class name ${customClassName}`, ()=> { + assert(wrapper.hasClass(customClassName)); + }); + it(`should have text ${text}`, ()=>{ assert(wrapper.text() === text); });