File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ const Label = (props) => {
7979 check && inline && disabled ? 'disabled' : false ,
8080 size ? `col-form-label-${ size } ` : false ,
8181 colClasses ,
82- colClasses . length ? 'col-form-label' : false
82+ colClasses . length ? 'col-form-label' : false ,
83+ ! check && ! colClasses . length ? 'form-control-label' : false
8384 ) , cssModule ) ;
8485
8586 return (
Original file line number Diff line number Diff line change @@ -21,6 +21,30 @@ describe('Label', () => {
2121 expect ( wrapper . hasClass ( 'extra' ) ) . toBe ( true ) ;
2222 } ) ;
2323
24+ it ( 'should render with "form-control-label" class' , ( ) => {
25+ const wrapper = shallow ( < Label > Yo!</ Label > ) ;
26+
27+ expect ( wrapper . hasClass ( 'form-control-label' ) ) . toBe ( true ) ;
28+ } ) ;
29+
30+ it ( 'should render with "form-control-label" class when inline prop is truthy' , ( ) => {
31+ const wrapper = shallow ( < Label inline > Yo!</ Label > ) ;
32+
33+ expect ( wrapper . hasClass ( 'form-control-label' ) ) . toBe ( true ) ;
34+ } ) ;
35+
36+ it ( 'should not render with "form-control-label" class when a col is provided' , ( ) => {
37+ const wrapper = shallow ( < Label sm = "6" > Yo!</ Label > ) ;
38+
39+ expect ( wrapper . hasClass ( 'form-control-label' ) ) . toBe ( false ) ;
40+ } ) ;
41+
42+ it ( 'should not render with "form-control-label" class when check prop is truthy' , ( ) => {
43+ const wrapper = shallow ( < Label check > Yo!</ Label > ) ;
44+
45+ expect ( wrapper . hasClass ( 'form-control-label' ) ) . toBe ( false ) ;
46+ } ) ;
47+
2448 it ( 'should render with "col-form-label" class when a col is provided' , ( ) => {
2549 const wrapper = shallow ( < Label sm = "6" > Yo!</ Label > ) ;
2650
You can’t perform that action at this time.
0 commit comments