diff --git a/src/SearchField/SearchField.test.jsx b/src/SearchField/SearchField.test.jsx index ac05fb5780..1f6cebba55 100644 --- a/src/SearchField/SearchField.test.jsx +++ b/src/SearchField/SearchField.test.jsx @@ -176,7 +176,7 @@ describe(' with basic usage', () => { const inputElement = screen.getByRole('searchbox'); await userEvent.type(inputElement, 'foobar'); const buttonClear = screen.getByRole('button', { type: 'reset', variant: buttonProps.variant }); - expect(buttonClear).toHaveAttribute('variant', 'inline'); + expect(buttonClear).toHaveClass(`btn-icon-${buttonProps.variant}`); }); it('should pass props to the label', () => { diff --git a/src/SearchField/SearchFieldAdvanced.jsx b/src/SearchField/SearchFieldAdvanced.jsx index a15de6bc53..ac0fafe190 100644 --- a/src/SearchField/SearchFieldAdvanced.jsx +++ b/src/SearchField/SearchFieldAdvanced.jsx @@ -7,8 +7,6 @@ import classNames from 'classnames'; import { Search, Close } from '../../icons'; import newId from '../utils/newId'; -import Icon from '../Icon'; - export const SearchFieldContext = createContext(); const BUTTON_LOCATION_VARIANTS = [ @@ -189,8 +187,8 @@ SearchFieldAdvanced.defaultProps = { clearButton: 'clear search', }, icons: { - clear: , - submit: , + clear: Close, + submit: Search, }, onBlur: () => {}, onChange: () => {}, diff --git a/src/SearchField/SearchFieldClearButton.jsx b/src/SearchField/SearchFieldClearButton.jsx index bf667fa0de..0dfd02d8f3 100644 --- a/src/SearchField/SearchFieldClearButton.jsx +++ b/src/SearchField/SearchFieldClearButton.jsx @@ -1,6 +1,8 @@ import React, { useContext } from 'react'; import { SearchFieldContext } from './SearchFieldAdvanced'; +import Icon from '../Icon'; +import IconButton from '../IconButton'; function SearchFieldClearButton(props) { const { @@ -18,11 +20,15 @@ function SearchFieldClearButton(props) { }; return ( - // eslint-disable-next-line react/button-has-type - + ); } diff --git a/src/SearchField/SearchFieldSubmitButton.jsx b/src/SearchField/SearchFieldSubmitButton.jsx index eff97e9004..86607dcf28 100644 --- a/src/SearchField/SearchFieldSubmitButton.jsx +++ b/src/SearchField/SearchFieldSubmitButton.jsx @@ -1,9 +1,10 @@ import React, { useContext } from 'react'; import PropTypes from 'prop-types'; -import classNames from 'classnames'; import { SearchFieldContext } from './SearchFieldAdvanced'; import Button from '../Button'; +import IconButton from '../IconButton'; +import Icon from '../Icon'; const STYLE_VARIANTS = [ 'light', @@ -40,16 +41,15 @@ function SearchFieldSubmitButton(props) { {screenReaderText.submitButton} ) : ( - + /> ); } diff --git a/src/SearchField/__snapshots__/SearchField.test.jsx.snap b/src/SearchField/__snapshots__/SearchField.test.jsx.snap index 9cd5cf7612..3e8b3a69ac 100644 --- a/src/SearchField/__snapshots__/SearchField.test.jsx.snap +++ b/src/SearchField/__snapshots__/SearchField.test.jsx.snap @@ -28,32 +28,32 @@ exports[` with basic usage should match the snapshot 1`] = ` value="" /> diff --git a/src/SearchField/index.jsx b/src/SearchField/index.jsx index af0fd63458..49a0fb5503 100644 --- a/src/SearchField/index.jsx +++ b/src/SearchField/index.jsx @@ -9,8 +9,6 @@ import SearchFieldInput from './SearchFieldInput'; import SearchFieldClearButton from './SearchFieldClearButton'; import SearchFieldSubmitButton from './SearchFieldSubmitButton'; -import Icon from '../Icon'; - export const SEARCH_FIELD_SCREEN_READER_TEXT_LABEL = 'search'; export const SEARCH_FIELD_SCREEN_READER_TEXT_SUBMIT_BUTTON = 'submit search'; export const SEARCH_FIELD_SCREEN_READER_TEXT_CLEAR_BUTTON = 'clear search'; @@ -170,8 +168,8 @@ SearchField.defaultProps = { clearButton: SEARCH_FIELD_SCREEN_READER_TEXT_CLEAR_BUTTON, }, icons: { - clear: , - submit: , + clear: Close, + submit: Search, }, onBlur: () => {}, onChange: () => {},