Skip to content

Commit

Permalink
fix: react radio button remove pseudo properties
Browse files Browse the repository at this point in the history
  • Loading branch information
AliKdhim87 authored and Robbert committed Aug 15, 2022
1 parent baf4940 commit e402ed1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
24 changes: 0 additions & 24 deletions packages/component-library-react/src/RadioButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ describe('RadioButton', () => {
});

describe('checked variant', () => {
it('renders a design system BEM modifier class name', () => {
const { container } = render(<RadioButton checked />);

const radioButton = container.querySelector(':only-child');

expect(radioButton).toHaveClass('utrecht-radio-button--checked');
});

it('is not checked by default', () => {
const { container } = render(<RadioButton />);

Expand Down Expand Up @@ -154,14 +146,6 @@ describe('RadioButton', () => {
expect(radioButton).not.toBeDisabled();
});

it('renders a design system BEM modifier class name', () => {
const { container } = render(<RadioButton disabled />);

const radioButton = container.querySelector(':only-child');

expect(radioButton).toHaveClass('utrecht-radio-button--disabled');
});

it('omits non-essential disabled attributes when not disabled', () => {
const { container } = render(<RadioButton disabled={false} />);

Expand Down Expand Up @@ -198,14 +182,6 @@ describe('RadioButton', () => {
expect(radioButton).not.toBeRequired();
});

it('renders a design system BEM modifier class name', () => {
const { container } = render(<RadioButton required />);

const radioButton = container.querySelector(':only-child');

expect(radioButton).toHaveClass('utrecht-radio-button--required');
});

it('omits non-essential required attributes when not required', () => {
const { container } = render(<RadioButton required={false} />);

Expand Down
10 changes: 1 addition & 9 deletions packages/component-library-react/src/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,17 @@ export interface RadioButtonProps extends Omit<InputHTMLAttributes<HTMLInputElem
}

export const RadioButton = forwardRef(
(
{ checked, disabled, invalid, required, className, ...restProps }: RadioButtonProps,
ref: ForwardedRef<HTMLInputElement>,
) => (
({ invalid, className, ...restProps }: RadioButtonProps, ref: ForwardedRef<HTMLInputElement>) => (
<input
{...restProps}
ref={ref}
type="radio"
className={clsx(
'utrecht-radio-button',
'utrecht-radio-button--html-input',
checked && 'utrecht-radio-button--checked',
disabled && 'utrecht-radio-button--disabled',
invalid && 'utrecht-radio-button--invalid',
required && 'utrecht-radio-button--required',
className,
)}
disabled={disabled}
required={required}
/>
),
);
Expand Down

1 comment on commit e402ed1

@vercel
Copy link

@vercel vercel bot commented on e402ed1 Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.