Skip to content

Commit 2561645

Browse files
authored
style: Clean up FormText code and tests (react-bootstrap#3907)
1 parent 0bb8a6f commit 2561645

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/FormText.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ const FormText = React.forwardRef(
3232
({ bsPrefix, className, as: Component = 'small', muted, ...props }, ref) => {
3333
bsPrefix = useBootstrapPrefix(bsPrefix, 'form-text');
3434

35-
const classes = classNames(className, bsPrefix, muted && 'text-muted');
36-
37-
return <Component {...props} ref={ref} className={classes} />;
35+
return (
36+
<Component
37+
{...props}
38+
ref={ref}
39+
className={classNames(className, bsPrefix, muted && 'text-muted')}
40+
/>
41+
);
3842
},
3943
);
4044

test/FormTextSpec.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,8 @@ describe('<FormText>', () => {
2323
it('Should have "form-text" & "text-muted" class', () => {
2424
expect(
2525
mount(<FormText muted />)
26-
.find('small')
27-
.hasClass('form-text'),
28-
).to.equal(true);
29-
expect(
30-
mount(<FormText muted />)
31-
.find('small')
26+
.find('small.form-text')
3227
.hasClass('text-muted'),
33-
).to.equal(true);
28+
).to.be.true;
3429
});
3530
});

0 commit comments

Comments
 (0)