From 3bfce12c4bdc9615399e8821629328f8a441d9b8 Mon Sep 17 00:00:00 2001 From: Phoebe Gao Date: Mon, 27 Sep 2021 15:13:41 -0700 Subject: [PATCH] fix(Label): add `form-label` class for labels of vertical forms (#2317) https://getbootstrap.com/docs/5.0/migration/#forms --- src/Label.js | 2 +- src/__tests__/Label.spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Label.js b/src/Label.js index 9c562f6a5..b6c5ffe00 100644 --- a/src/Label.js +++ b/src/Label.js @@ -99,7 +99,7 @@ const Label = (props) => { check ? 'form-check-label' : false, size ? `col-form-label-${size}` : false, colClasses, - colClasses.length ? 'col-form-label' : false + colClasses.length ? 'col-form-label' : 'form-label' ), cssModule); return ( diff --git a/src/__tests__/Label.spec.js b/src/__tests__/Label.spec.js index d71e4b218..4aef120a0 100644 --- a/src/__tests__/Label.spec.js +++ b/src/__tests__/Label.spec.js @@ -27,10 +27,10 @@ describe('Label', () => { expect(wrapper.hasClass('col-form-label')).toBe(true); }); - it('should not render with "col-form-label" class when a col is not provided', () => { + it('should render with "form-label" class when a col is not provided', () => { const wrapper = shallow(); - expect(wrapper.hasClass('col-form-label')).toBe(false); + expect(wrapper.hasClass('form-label')).toBe(true); }); it('should pass col size specific classes as Strings', () => {