mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Fixing FormTextField props and test (#17939)
This commit is contained in:
parent
c8e8db2666
commit
abff49561d
@ -1,5 +1,6 @@
|
||||
/* eslint-disable jest/require-top-level-describe */
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { fireEvent, render } from '@testing-library/react';
|
||||
import { renderWithUserEvent } from '../../../../test/lib/render-helpers';
|
||||
|
||||
@ -227,9 +228,19 @@ describe('TextField', () => {
|
||||
expect(getByTestId('text-field-required')).toHaveAttribute('required', '');
|
||||
});
|
||||
it('should render with a custom input and still work', async () => {
|
||||
const CustomInputComponent = React.forwardRef((props, ref) => (
|
||||
<Box ref={ref} as="input" {...props} />
|
||||
));
|
||||
const CustomInputComponent = React.forwardRef(
|
||||
({ disableStateStyles, ...props }, ref) => (
|
||||
<Box
|
||||
ref={ref}
|
||||
as="input"
|
||||
{...props}
|
||||
placeholder={`Removing ${disableStateStyles} from ...props spread to prevent error in test`}
|
||||
/>
|
||||
),
|
||||
);
|
||||
CustomInputComponent.propTypes = {
|
||||
disableStateStyles: PropTypes.bool,
|
||||
};
|
||||
CustomInputComponent.displayName = 'CustomInputComponent'; // fixes eslint error
|
||||
const { getByTestId, user } = renderWithUserEvent(
|
||||
<TextField
|
||||
|
Loading…
Reference in New Issue
Block a user