diff --git a/src/components/Search/Search/Search.test.tsx b/src/components/Search/Search/Search.test.tsx index 7fa4b0e538..76e99ae6ac 100644 --- a/src/components/Search/Search/Search.test.tsx +++ b/src/components/Search/Search/Search.test.tsx @@ -47,14 +47,14 @@ describe('Search component', () => { it('renders a label', () => { const mockSubmit = jest.fn() - const { queryByLabelText } = render( + const { queryAllByLabelText } = render( ) - expect(queryByLabelText('Buscar')).toBeInTheDocument() + expect(queryAllByLabelText('Buscar')).toHaveLength(2) }) it('does not render button text when small', () => { diff --git a/src/components/Search/Search/Search.tsx b/src/components/Search/Search/Search.tsx index 5687b8bcee..9000ca07e2 100644 --- a/src/components/Search/Search/Search.tsx +++ b/src/components/Search/Search/Search.tsx @@ -19,6 +19,7 @@ type SearchInputProps = { placeholder?: string label?: React.ReactNode i18n?: SearchLocalization + buttonAriaLabel?: string inputProps?: OptionalTextInputProps } @@ -31,6 +32,7 @@ export const Search = ({ label = 'Search', inputId = 'search-field', i18n, + buttonAriaLabel, inputProps, ...formProps }: SearchInputProps & OptionalFormProps): React.ReactElement => { @@ -52,7 +54,7 @@ export const Search = ({ label={label} defaultValue={formProps.defaultValue} /> - + ) } diff --git a/src/components/Search/SearchButton/SearchButton.tsx b/src/components/Search/SearchButton/SearchButton.tsx index c69c4625fe..aae112b1e2 100644 --- a/src/components/Search/SearchButton/SearchButton.tsx +++ b/src/components/Search/SearchButton/SearchButton.tsx @@ -13,12 +13,14 @@ type SearchButtonProps = { size?: 'big' | 'small' className?: string i18n?: SearchLocalization + buttonAriaLabel?: string } export const SearchButton = ({ size, className, i18n, + buttonAriaLabel, }: SearchButtonProps): React.ReactElement => { const buttonText = i18n?.buttonText || 'Search' const isSmall = size === 'small' @@ -33,7 +35,7 @@ export const SearchButton = ({ ) return (
-