File tree Expand file tree Collapse file tree 10 files changed +55
-25
lines changed Expand file tree Collapse file tree 10 files changed +55
-25
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,15 @@ import classNames from 'classnames';
9
9
10
10
export default class CellBody extends React . Component {
11
11
render ( ) {
12
- const { children, ...others } = this . props ;
13
- const className = classNames ( {
12
+ const { className , children, ...others } = this . props ;
13
+ const cls = classNames ( {
14
14
weui_cell_bd : true ,
15
- weui_cell_primary : true
15
+ weui_cell_primary : true ,
16
+ [ className ] : className
16
17
} ) ;
17
18
18
19
return (
19
- < div className = { className } { ...others } > { children } </ div >
20
+ < div className = { cls } { ...others } > { children } </ div >
20
21
) ;
21
22
}
22
23
} ;
Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ import classNames from 'classnames';
9
9
10
10
export default class CellFooter extends React . Component {
11
11
render ( ) {
12
- const { children, ...others } = this . props ;
13
- const className = classNames ( {
14
- weui_cell_ft : true
12
+ const { className, children, ...others } = this . props ;
13
+ const cls = classNames ( {
14
+ weui_cell_ft : true ,
15
+ [ className ] : className
15
16
} ) ;
16
17
17
18
return (
18
- < div className = { className } { ...others } > { children } </ div >
19
+ < div className = { cls } { ...others } > { children } </ div >
19
20
) ;
20
21
}
21
22
} ;
Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ import classNames from 'classnames';
9
9
10
10
export default class CellHeader extends React . Component {
11
11
render ( ) {
12
- const { children, ...others } = this . props ;
13
- const className = classNames ( {
14
- weui_cell_hd : true
12
+ const { className, children, ...others } = this . props ;
13
+ const cls = classNames ( {
14
+ weui_cell_hd : true ,
15
+ [ className ] : className
15
16
} ) ;
16
17
17
18
return (
18
- < div className = { className } { ...others } > { children } </ div >
19
+ < div className = { cls } { ...others } > { children } </ div >
19
20
) ;
20
21
}
21
22
} ;
Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ import classNames from 'classnames';
9
9
10
10
export default class CellsTips extends React . Component {
11
11
render ( ) {
12
- const { children, ...others } = this . props ;
13
- const className = classNames ( {
14
- weui_cells_tips : true
12
+ const { className, children, ...others } = this . props ;
13
+ const cls = classNames ( {
14
+ weui_cells_tips : true ,
15
+ [ className ] : className
15
16
} ) ;
16
17
17
18
return (
18
- < div className = { className } { ...others } > { children } </ div >
19
+ < div className = { cls } { ...others } > { children } </ div >
19
20
) ;
20
21
}
21
22
} ;
Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ import classNames from 'classnames';
9
9
10
10
export default class CellsTitle extends React . Component {
11
11
render ( ) {
12
- const { children, ...others } = this . props ;
13
- const className = classNames ( {
14
- weui_cells_title : true
12
+ const { className, children, ...others } = this . props ;
13
+ const cls = classNames ( {
14
+ weui_cells_title : true ,
15
+ [ className ] : className
15
16
} ) ;
16
17
17
18
return (
18
- < div className = { className } { ...others } > { children } </ div >
19
+ < div className = { cls } { ...others } > { children } </ div >
19
20
) ;
20
21
}
21
22
} ;
Original file line number Diff line number Diff line change @@ -15,8 +15,9 @@ describe('<CellBody></CellBody>', ()=> {
15
15
16
16
[ 'cell body wording' , < img src = "http://mmrb.github.io/avatar/jf.jpg" /> , < div > < h2 className = "title" > 文章标题</ h2 > < p className = "desc" > 文章描述</ p > </ div > ] . map ( ( child ) => {
17
17
describe ( `<CellBody>${ child } </CellBody>` , ( ) => {
18
+ const customClassName = 'customClassName1 customClassName2' ;
18
19
const wrapper = shallow (
19
- < CellBody > { child } </ CellBody >
20
+ < CellBody className = { customClassName } > { child } </ CellBody >
20
21
) ;
21
22
22
23
it ( `should render <CellBody></CellBody> component ` , ( ) => {
@@ -27,6 +28,10 @@ describe('<CellBody></CellBody>', ()=> {
27
28
assert ( wrapper . hasClass ( `weui_cell_bd` ) ) ;
28
29
} ) ;
29
30
31
+ it ( `should have custom class name ${ customClassName } ` , ( ) => {
32
+ assert ( wrapper . hasClass ( customClassName ) ) ;
33
+ } ) ;
34
+
30
35
it ( `should have child ${ child } ` , ( ) => {
31
36
assert ( wrapper . contains ( child ) ) ;
32
37
} ) ;
Original file line number Diff line number Diff line change @@ -15,8 +15,9 @@ describe('<CellFooter></CellFooter>', ()=> {
15
15
16
16
[ 'cell footer wording' , < img src = "http://mmrb.github.io/avatar/bear.jpg" /> ] . map ( ( child ) => {
17
17
describe ( `<CellFooter>${ child } </CellFooter>` , ( ) => {
18
+ const customClassName = 'customClassName1 customClassName2' ;
18
19
const wrapper = shallow (
19
- < CellFooter > { child } </ CellFooter >
20
+ < CellFooter className = { customClassName } > { child } </ CellFooter >
20
21
) ;
21
22
22
23
it ( `should render <CellFooter></CellFooter> component ` , ( ) => {
@@ -27,6 +28,10 @@ describe('<CellFooter></CellFooter>', ()=> {
27
28
assert ( wrapper . hasClass ( `weui_cell_ft` ) ) ;
28
29
} ) ;
29
30
31
+ it ( `should have custom class name ${ customClassName } ` , ( ) => {
32
+ assert ( wrapper . hasClass ( customClassName ) ) ;
33
+ } ) ;
34
+
30
35
it ( `should have child ${ child } ` , ( ) => {
31
36
assert ( wrapper . contains ( child ) ) ;
32
37
} ) ;
Original file line number Diff line number Diff line change @@ -15,8 +15,9 @@ describe('<CellHeader></CellHeader>', ()=> {
15
15
16
16
[ 'cell header wording' , < img src = "http://mmrb.github.io/avatar/jf.jpg" /> , < p > cell header wording</ p > ] . map ( ( child ) => {
17
17
describe ( `<CellHeader>${ child } </CellHeader>` , ( ) => {
18
+ const customClassName = 'customClassName1 customClassName2' ;
18
19
const wrapper = shallow (
19
- < CellHeader > { child } </ CellHeader >
20
+ < CellHeader className = { customClassName } > { child } </ CellHeader >
20
21
) ;
21
22
22
23
it ( `should render <CellHeader></CellHeader> component ` , ( ) => {
@@ -27,6 +28,10 @@ describe('<CellHeader></CellHeader>', ()=> {
27
28
assert ( wrapper . hasClass ( `weui_cell_hd` ) ) ;
28
29
} ) ;
29
30
31
+ it ( `should have custom class name ${ customClassName } ` , ( ) => {
32
+ assert ( wrapper . hasClass ( customClassName ) ) ;
33
+ } ) ;
34
+
30
35
it ( `should have child ${ child } ` , ( ) => {
31
36
assert ( wrapper . contains ( child ) ) ;
32
37
} ) ;
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ const {CellsTips} = WeUI;
14
14
describe ( '<CellsTips></CellsTips>' , ( ) => {
15
15
16
16
const text = `cells tips wording` ;
17
+ const customClassName = 'customClassName1 customClassName2' ;
17
18
const wrapper = shallow (
18
- < CellsTips > { text } </ CellsTips >
19
+ < CellsTips className = { customClassName } > { text } </ CellsTips >
19
20
) ;
20
21
21
22
it ( `should render <CellsTips></CellsTips> component ` , ( ) => {
@@ -26,6 +27,10 @@ describe('<CellsTips></CellsTips>', ()=> {
26
27
assert ( wrapper . hasClass ( `weui_cells_tips` ) ) ;
27
28
} ) ;
28
29
30
+ it ( `should have custom class name ${ customClassName } ` , ( ) => {
31
+ assert ( wrapper . hasClass ( customClassName ) ) ;
32
+ } ) ;
33
+
29
34
it ( `should have text ${ text } ` , ( ) => {
30
35
assert ( wrapper . text ( ) === text ) ;
31
36
} ) ;
Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ const {CellsTitle} = WeUI;
14
14
describe ( '<CellsTitle></CellsTitle>' , ( ) => {
15
15
16
16
const text = `cells tips wording` ;
17
+ const customClassName = 'customClassName1 customClassName2' ;
17
18
const wrapper = shallow (
18
- < CellsTitle > { text } </ CellsTitle >
19
+ < CellsTitle className = { customClassName } > { text } </ CellsTitle >
19
20
) ;
20
21
21
22
it ( `should render <CellsTitle></CellsTitle> component ` , ( ) => {
@@ -26,6 +27,10 @@ describe('<CellsTitle></CellsTitle>', ()=> {
26
27
assert ( wrapper . hasClass ( `weui_cells_title` ) ) ;
27
28
} ) ;
28
29
30
+ it ( `should have custom class name ${ customClassName } ` , ( ) => {
31
+ assert ( wrapper . hasClass ( customClassName ) ) ;
32
+ } ) ;
33
+
29
34
it ( `should have text ${ text } ` , ( ) => {
30
35
assert ( wrapper . text ( ) === text ) ;
31
36
} ) ;
You can’t perform that action at this time.
0 commit comments