From 2e861320a006d12061e08d4e06d6b8487d2f89b5 Mon Sep 17 00:00:00 2001 From: Matthew Heck Date: Tue, 27 Jun 2017 11:53:39 -0400 Subject: [PATCH] fix(Label): add form-control-label to appropriate Label components (#452) --- src/Label.js | 3 ++- src/__tests__/Label.spec.js | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Label.js b/src/Label.js index 30fdd7ed3..d03fc759c 100644 --- a/src/Label.js +++ b/src/Label.js @@ -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 ( diff --git a/src/__tests__/Label.spec.js b/src/__tests__/Label.spec.js index d92f6f139..7b7929e5d 100644 --- a/src/__tests__/Label.spec.js +++ b/src/__tests__/Label.spec.js @@ -21,6 +21,30 @@ describe('Label', () => { expect(wrapper.hasClass('extra')).toBe(true); }); + it('should render with "form-control-label" class', () => { + const wrapper = shallow(); + + expect(wrapper.hasClass('form-control-label')).toBe(true); + }); + + it('should render with "form-control-label" class when inline prop is truthy', () => { + const wrapper = shallow(); + + 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(); + + 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(); + + expect(wrapper.hasClass('form-control-label')).toBe(false); + }); + it('should render with "col-form-label" class when a col is provided', () => { const wrapper = shallow();