mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Adding some propType fixes to TextFieldBase
(#16508)
* Adding some propType fixes * lint fixes
This commit is contained in:
parent
6907c4a565
commit
be5d70623e
@ -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.
|
||||
*/
|
||||
|
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user