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
6 changes: 6 additions & 0 deletions src/text-filter/__tests__/text-filter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { render } from '@testing-library/react';
import { DEBOUNCE_DEFAULT_DELAY } from '../../../lib/components/internal/debounce';
import TextFilter, { TextFilterProps } from '../../../lib/components/text-filter';
import createWrapper from '../../../lib/components/test-utils/dom';
import '../../__a11y__/to-validate-a11y';

function renderTextFilter(jsx: React.ReactElement) {
const { container } = render(jsx);
Expand Down Expand Up @@ -106,3 +107,8 @@ describe('countText', () => {
expect(wrapper.findResultsCount().getElement().textContent).toEqual('10 matches');
});
});

test('check a11y', async () => {
const { wrapper } = renderTextFilter(<TextFilter filteringText="" filteringAriaLabel="filter instances" />);
await expect(wrapper.getElement()).toValidateA11y();
});
4 changes: 2 additions & 2 deletions src/text-filter/internal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const InternalTextFilter = React.forwardRef(
const showResults = filteringText && countText && !disabled;

return (
<span {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>
<div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>
<InternalInput
ref={inputRef}
className={styles.input}
Expand All @@ -53,7 +53,7 @@ const InternalTextFilter = React.forwardRef(
>
{showResults ? countText : ''}
</span>
</span>
</div>
);
}
);
Expand Down