1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

Adding some propType fixes to TextFieldBase (#16508)

* Adding some propType fixes

* lint fixes
This commit is contained in:
George Marshall 2022-11-15 10:06:59 -08:00 committed by GitHub
parent 6907c4a565
commit be5d70623e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -155,7 +155,7 @@ TextFieldBase.propTypes = {
/**
* Autocomplete allows the browser to predict the value based on earlier typed values
*/
autoComplete: PropTypes.string,
autoComplete: PropTypes.bool,
/**
* If `true`, the input will be focused during the first mount.
*/

View File

@ -2,9 +2,10 @@
import React from 'react';
import { fireEvent, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SIZES } from '../../../helpers/constants/design-system';
import Box from '../../ui/box';
import { TextFieldBase } from './text-field-base';
describe('TextFieldBase', () => {
@ -188,11 +189,7 @@ describe('TextFieldBase', () => {
});
it('should render with error className when error is true', () => {
const { getByTestId } = render(
<TextFieldBase
error
value="error value"
data-testid="text-field-base-error"
/>,
<TextFieldBase error data-testid="text-field-base-error" />,
);
expect(getByTestId('text-field-base-error')).toHaveClass(
'mm-text-field-base--error',
@ -236,7 +233,10 @@ describe('TextFieldBase', () => {
);
});
it('should render with a custom input and still work', () => {
const CustomInputComponent = (props) => <input {...props} />;
const CustomInputComponent = React.forwardRef((props, ref) => (
<Box ref={ref} as="input" {...props} />
));
CustomInputComponent.displayName = 'CustomInputComponent'; // fixes eslint error
const { getByTestId } = render(
<TextFieldBase
InputComponent={CustomInputComponent}