Skip to content

Commit 2e86132

Browse files
matthewheckeddywashere
authored andcommitted
fix(Label): add form-control-label to appropriate Label components (#452)
1 parent f607b2c commit 2e86132

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/Label.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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 (

src/__tests__/Label.spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)