Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/WP-261: Search bar component - fix js warnings related to button usage #974

Merged
merged 4 commits into from
Oct 14, 2024
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
11 changes: 7 additions & 4 deletions client/src/components/_common/Searchbar/Searchbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ const Searchbar = ({
)}
{((hasQuery && !siteSearch) ||
(filterType && filterType !== allFilterTypesValue && filterTypes)) && (
<Button attr="reset" type="link" onClick={onClear}>
<span data-testid="clear-button">
Back to All {dataType ? dataType : 'Results'}
</span>
<Button
attr="reset"
type="link"
onClick={onClear}
dataTestid="clear-button"
>
{`Back to All ${dataType ? dataType : 'Results'}`}
</Button>
)}
</form>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/_common/Searchbar/Searchbar.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('Searchbar', () => {

const element = getByTestId('clear-button');

expect(element.innerHTML).toBe('Back to All Files');
expect(element.textContent).toBe('Back to All Files');
});

it('shows correct label when no dataType is sent', async () => {
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('Searchbar', () => {

const element = getByTestId('clear-button');

expect(element.innerHTML).toBe('Back to All Results');
expect(element.textContent).toBe('Back to All Results');
});

it('has expected elements', () => {
Expand Down
Loading