Skip to content

Commit

Permalink
feat: group wrapper should have disabled cls
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Dec 15, 2023
1 parent 1aec10f commit 1b917ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/BaseInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const BaseInput: FC<BaseInputProps> = (props) => {
if (hasAddon(props)) {
const wrapperCls = `${prefixCls}-group`;
const addonCls = `${wrapperCls}-addon`;
const groupWrapperCls = `${wrapperCls}-wrapper`;

const mergedWrapperClassName = clsx(
`${prefixCls}-wrapper`,
Expand All @@ -139,7 +140,10 @@ const BaseInput: FC<BaseInputProps> = (props) => {
);

const mergedGroupClassName = clsx(
`${prefixCls}-group-wrapper`,
groupWrapperCls,
{
[`${groupWrapperCls}-disabled`]: disabled,
},
classes?.group,
classNames?.groupWrapper,
);
Expand Down
10 changes: 10 additions & 0 deletions tests/BaseInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,14 @@ describe('BaseInput', () => {
?.style.color,
).toBe('blue');
});

it('with addon and disabled', () => {
const { container } = render(
<BaseInput prefixCls="rc-input" addonBefore="addon" disabled>
<input />
</BaseInput>,
);

expect(container.firstChild).toHaveClass('rc-input-group-wrapper-disabled');
});
});

0 comments on commit 1b917ae

Please sign in to comment.