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

Commit

Permalink
fix(rish): hide reset button when search is stalled in SearchBox (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aymeric-giraudet authored Sep 9, 2022
1 parent f7251a4 commit 93ee9d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit 93ee9d0

Please sign in to comment.