Skip to content

Commit

Permalink
refactor: avoid having unexecuted code for non-existing APIs
Browse files Browse the repository at this point in the history
Causes TypeScript linting errors
  • Loading branch information
Robbert authored and Yolijn committed Aug 4, 2024
1 parent 1e75738 commit 55e6e72
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
16 changes: 2 additions & 14 deletions packages/component-library-react/src/FormFieldTextbox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,7 @@ describe('Form field with a textbox', () => {
});

// Test doesn't work, Testing Library doesn't support testing read only state
it.skip('is not read-only by default', () => {
render(<FormFieldTextbox {...defaultProps} />);

const textbox = screen.getByRole('textbox');

expect(textbox).not.toBeReadOnly();
});
it.skip('is not read-only in the accessibility tree by default', () => {});

it('omits non-essential disabled attributes when not read-only', () => {
render(<FormFieldTextbox {...defaultProps} readOnly={false} />);
Expand All @@ -654,13 +648,7 @@ describe('Form field with a textbox', () => {
});

// Test doesn't work, Testing Library doesn't support testing read only state
it.skip('can have a read-only state', () => {
render(<FormFieldTextbox {...defaultProps} disabled />);

const textbox = screen.getByRole('textbox');

expect(textbox).toBeReadonly();
});
it.skip('can have a read-only state in the accessibility tree', () => {});

it('can have a read-only state in CSS', () => {
const { container } = render(<FormFieldTextbox {...defaultProps} readOnly />);
Expand Down
4 changes: 2 additions & 2 deletions packages/component-library-react/src/IndexCharNav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ describe('Index character navigation', () => {
}));

render(<IndexCharNav onLinkClick={mockHandleLetterClick} characters={characters} component="button" />);
const buttons = screen.getAllByRole('button');
fireEvent.click(buttons[0]);
const button = screen.getByRole('button', { name: 'A' });
fireEvent.click(button);

expect(mockHandleLetterClick).toHaveBeenCalledWith('A');
});
Expand Down
8 changes: 1 addition & 7 deletions packages/component-library-react/src/Listbox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ describe('Listbox', () => {

describe('read-only state', () => {
// `isReadOnly()` is not supported, unfortunately
it.skip('has a read-only listbox', () => {
render(<Listbox disabled />);

const listbox = screen.getByRole('listbox');

expect(listbox).isReadOnly();
});
it.skip('has a listbox that is read-only in the accessibility tree', () => {});
});

it('supports ForwardRef in React', () => {
Expand Down

0 comments on commit 55e6e72

Please sign in to comment.