File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,9 +78,9 @@ const Col = (props) => {
7878
7979 colClasses . push ( mapToCssModules ( classNames ( {
8080 [ colClass ] : columnProp . size || columnProp . size === '' ,
81- [ `push${ colSizeInterfix } ${ columnProp . push } ` ] : columnProp . push ,
82- [ `pull${ colSizeInterfix } ${ columnProp . pull } ` ] : columnProp . pull ,
83- [ `offset${ colSizeInterfix } ${ columnProp . offset } ` ] : columnProp . offset
81+ [ `push${ colSizeInterfix } ${ columnProp . push } ` ] : columnProp . push || columnProp . push === 0 ,
82+ [ `pull${ colSizeInterfix } ${ columnProp . pull } ` ] : columnProp . pull || columnProp . pull === 0 ,
83+ [ `offset${ colSizeInterfix } ${ columnProp . offset } ` ] : columnProp . offset || columnProp . offset === 0
8484 } ) ) , cssModule ) ;
8585 } else {
8686 colClass = getColumnSizeClass ( isXs , colWidth , columnProp ) ;
Original file line number Diff line number Diff line change @@ -70,6 +70,16 @@ describe('Col', () => {
7070 expect ( wrapper . hasClass ( 'offset-sm-2' ) ) . toBe ( true ) ;
7171 } ) ;
7272
73+ it ( 'should pass col size specific classes via Objects including 0' , ( ) => {
74+ const wrapper = shallow ( < Col sm = { { size : 6 , push : 0 , pull : 0 , offset : 0 } } /> ) ;
75+
76+ expect ( wrapper . hasClass ( 'col-sm-6' ) ) . toBe ( true ) ;
77+ expect ( wrapper . hasClass ( 'col' ) ) . toBe ( true ) ;
78+ expect ( wrapper . hasClass ( 'push-sm-0' ) ) . toBe ( true ) ;
79+ expect ( wrapper . hasClass ( 'pull-sm-0' ) ) . toBe ( true ) ;
80+ expect ( wrapper . hasClass ( 'offset-sm-0' ) ) . toBe ( true ) ;
81+ } ) ;
82+
7383 it ( 'should pass col size when passing via object with size "auto"' , ( ) => {
7484 const wrapper = shallow ( < Col
7585 sm = { { size : 'auto' , push : 2 , pull : 2 , offset : 2 } }
You can’t perform that action at this time.
0 commit comments