Skip to content

Commit

Permalink
Merge branch 'main' into page-header__bottom-border
Browse files Browse the repository at this point in the history
  • Loading branch information
meissadia authored May 22, 2024
2 parents 0c0f306 + bd1895d commit 5f4ef04
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/components/RadioButton/RadioButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ describe('<RadioButton />', () => {
expect(element.getAttribute('disabled')).toBe('');
});

it('accepts additional input element props', () => {
const properties = buildProperties('default-checked');
render(<RadioButton {...properties} defaultChecked />);

const element = screen.getByRole(role);

expect(element).toBeInTheDocument();
expect(element).toBeChecked();
});

it('Select via click', () => {
const properties = buildProperties('click');
render(<RadioButton {...properties} />);
Expand Down
4 changes: 3 additions & 1 deletion src/components/RadioButton/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const RadioButton = ({
labelClassName,
labelInline = true, // 'true' REMOVES the a.label__heading class
label,
inputRef
inputRef,
...properties
}: JSX.IntrinsicElements['input'] & RadioProperties): React.ReactElement => {
const classes = [...baseStyles, className].join(' ');
const containerClasses = [
Expand All @@ -50,6 +51,7 @@ export const RadioButton = ({
className={classes}
ref={inputRef}
disabled={disabled}
{...properties}
/>
<Label htmlFor={id} className={labelClassName} inline={labelInline}>
{label}
Expand Down

0 comments on commit 5f4ef04

Please sign in to comment.