Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

fix(rish): hide reset button when search is stalled in SearchBox #3617

Merged
merged 1 commit into from
Sep 9, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export function SearchBox({
className={cx('ais-SearchBox-reset', classNames.reset)}
type="reset"
title={translations.resetTitle}
hidden={value.length === 0 && !isSearchStalled}
hidden={value.length === 0 || isSearchStalled}
>
<ResetIcon classNames={classNames} />
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,14 @@ describe('SearchBox', () => {
expect(container.querySelector('.ais-SearchBox-reset')).not.toBeVisible();
});

test('with search stalled hides the reset indicator', () => {
const props = createProps({ value: 'query', isSearchStalled: true });

const { container } = render(<SearchBox {...props} />);

expect(container.querySelector('.ais-SearchBox-reset')).not.toBeVisible();
});

test('with search stalled shows the loading indicator', () => {
const props = createProps({ isSearchStalled: true });

Expand Down