Skip to content

Commit

Permalink
fix(Label): add form-control-label to appropriate Label components (#452
Browse files Browse the repository at this point in the history
)
  • Loading branch information
matthewheck authored and eddywashere committed Jun 27, 2017
1 parent f607b2c commit 2e86132
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Label.js
Expand Up @@ -79,7 +79,8 @@ const Label = (props) => {
check && inline && disabled ? 'disabled' : false,
size ? `col-form-label-${size}` : false,
colClasses,
colClasses.length ? 'col-form-label' : false
colClasses.length ? 'col-form-label' : false,
!check && !colClasses.length ? 'form-control-label' : false
), cssModule);

return (
Expand Down
24 changes: 24 additions & 0 deletions src/__tests__/Label.spec.js
Expand Up @@ -21,6 +21,30 @@ describe('Label', () => {
expect(wrapper.hasClass('extra')).toBe(true);
});

it('should render with "form-control-label" class', () => {
const wrapper = shallow(<Label>Yo!</Label>);

expect(wrapper.hasClass('form-control-label')).toBe(true);
});

it('should render with "form-control-label" class when inline prop is truthy', () => {
const wrapper = shallow(<Label inline>Yo!</Label>);

expect(wrapper.hasClass('form-control-label')).toBe(true);
});

it('should not render with "form-control-label" class when a col is provided', () => {
const wrapper = shallow(<Label sm="6">Yo!</Label>);

expect(wrapper.hasClass('form-control-label')).toBe(false);
});

it('should not render with "form-control-label" class when check prop is truthy', () => {
const wrapper = shallow(<Label check>Yo!</Label>);

expect(wrapper.hasClass('form-control-label')).toBe(false);
});

it('should render with "col-form-label" class when a col is provided', () => {
const wrapper = shallow(<Label sm="6">Yo!</Label>);

Expand Down

0 comments on commit 2e86132

Please sign in to comment.