diff --git a/ui/components/ui/text-field/text-field.component.js b/ui/components/ui/text-field/text-field.component.js index eaae77759..f4062cf4c 100644 --- a/ui/components/ui/text-field/text-field.component.js +++ b/ui/components/ui/text-field/text-field.component.js @@ -204,6 +204,7 @@ const themeToInputProps = { }; const TextField = ({ + 'data-testid': dataTestId, error, classes, theme, @@ -228,7 +229,7 @@ const TextField = ({ autoComplete, }); - if (onPaste) { + if (onPaste || dataTestId) { if (!inputProps.InputProps) { inputProps.InputProps = {}; } @@ -236,6 +237,7 @@ const TextField = ({ inputProps.InputProps.inputProps = {}; } inputProps.InputProps.inputProps.onPaste = onPaste; + inputProps.InputProps.inputProps['data-testid'] = dataTestId; } return ( @@ -255,6 +257,10 @@ TextField.defaultProps = { }; TextField.propTypes = { + /** + * A test ID that gets set on the input element + */ + 'data-testid': PropTypes.string, /** * Show error message */ diff --git a/ui/pages/swaps/searchable-item-list/__snapshots__/searchable-item-list.test.js.snap b/ui/pages/swaps/searchable-item-list/__snapshots__/searchable-item-list.test.js.snap index be6f2c9c8..6f46e9f58 100644 --- a/ui/pages/swaps/searchable-item-list/__snapshots__/searchable-item-list.test.js.snap +++ b/ui/pages/swaps/searchable-item-list/__snapshots__/searchable-item-list.test.js.snap @@ -3,7 +3,6 @@ exports[`SearchableItemList renders the component with initial props 1`] = `