Skip to content

Commit

Permalink
fix(FormLabel): Add missing class for col label sizing (#5382)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Aug 14, 2020
1 parent 62a9d8b commit 52e92fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/FormLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ const FormLabel: FormLabel = React.forwardRef(
bsPrefix = useBootstrapPrefix(bsPrefix, 'form-label');

let columnClass = 'col-form-label';
if (typeof column === 'string') columnClass = `${columnClass}-${column}`;
if (typeof column === 'string')
columnClass = `${columnClass} ${columnClass}-${column}`;

const classes = classNames(
className,
bsPrefix,
Expand Down
4 changes: 2 additions & 2 deletions test/FormLabelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ describe('<FormLabel>', () => {

it('should properly size itself when rendered as a Col', () => {
mount(<FormLabel column="sm">Label</FormLabel>).assertSingle(
'label.col-form-label-sm',
'label.col-form-label.col-form-label-sm',
);
mount(<FormLabel column>Label</FormLabel>).assertSingle(
'label.col-form-label',
);
mount(<FormLabel column="lg">Label</FormLabel>).assertSingle(
'label.col-form-label-lg',
'label.col-form-label.col-form-label-lg',
);
let labelComponent = mount(<FormLabel>Label</FormLabel>);
labelComponent.assertNone('label.col-form-label');
Expand Down

0 comments on commit 52e92fc

Please sign in to comment.