Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/formInput/FormInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export const FormInput = ({
onBlur={handleBlur}
required={required}
className={inputClassName}
aria-label={ariaLabel || name}
aria-label={ariaLabel}
aria-required={ariaRequired}
tabIndex={tabIndex}
{...inputProps}
Expand Down
14 changes: 6 additions & 8 deletions src/formInput/__tests__/FormInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,8 @@ describe('FormInput', () => {
}}
/>
);
const inputContainer: Element | null = container.querySelector(
'.myClassName'
);
const inputContainer: Element | null =
container.querySelector('.myClassName');
expect(inputContainer).not.toBeNull();
});

Expand Down Expand Up @@ -439,9 +438,8 @@ describe('FormInput', () => {
const { container } = render(<DummyComponentTriggerError />);
const button = screen.getByRole('button');
await user.click(button);
const inputContainer: Element | null = container.querySelector(
'.error-container'
);
const inputContainer: Element | null =
container.querySelector('.error-container');
expect(inputContainer).not.toBeNull();
});

Expand Down Expand Up @@ -521,7 +519,7 @@ describe('FormInput', () => {
expect(error.innerHTML).toContain('static error message');
});

it('should display the aria-label name if the aria-label attribute is not passed', () => {
it('should not display the aria-label name if the aria-label attribute is not passed', () => {
const handleChange = jest.fn();
render(
<FormInput
Expand All @@ -538,7 +536,7 @@ describe('FormInput', () => {
/>
);
const input = screen.getByRole('textbox');
expect(input.getAttribute('aria-label')).toBe('password');
expect(input.getAttribute('aria-label')).toBeNull();
});

it('should have a 0 tabIndex value by default', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/formRadio/FormRadio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const FormRadio = ({
inputProps={inputProps}
itemProps={itemProps}
labelProps={labelProps}
ariaLabel={ariaLabel || name}
ariaLabel={ariaLabel}
ariaDataControls={ariaDataControls}
ariaDescribedBy={ariaDescribedBy}
ariaLabelledBy={ariaLabelledBy || labelProps?.id}
Expand Down
6 changes: 2 additions & 4 deletions src/formRadio/__test__/FormRadio.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('FormRadio', () => {
);
});

it('should render a radio with aria label match name if unspecified', () => {
it('should not render a radio with aria label match name if unspecified', () => {
const handleChange = jest.fn();

render(
Expand All @@ -99,9 +99,7 @@ describe('FormRadio', () => {
/>
);

expect(screen.getByLabelText('my label').getAttribute('aria-label')).toBe(
'group1'
);
expect(screen.getByLabelText('my label').getAttribute('aria-label')).toBeNull();
});

it('should render a radio with an id', () => {
Expand Down