1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fixing prop type errors in components and tests (#17704)

This commit is contained in:
George Marshall 2023-02-14 09:34:19 -08:00 committed by GitHub
parent ec870cebc6
commit aee1971496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View File

@ -7,11 +7,12 @@ import { AvatarFavicon, AVATAR_FAVICON_SIZES } from '.';
describe('AvatarFavicon', () => {
const args = {
src: './images/eth_logo.svg',
name: 'test',
};
it('should render correctly', () => {
const { getByTestId, container } = render(
<AvatarFavicon data-testid="avatar-favicon" />,
<AvatarFavicon name="test" data-testid="avatar-favicon" />,
);
expect(getByTestId('avatar-favicon')).toBeDefined();
expect(container).toMatchSnapshot();
@ -26,7 +27,7 @@ describe('AvatarFavicon', () => {
it('should render fallback image if no ImageSource is provided', () => {
const { container } = render(
<AvatarFavicon data-testid="avatar-favicon" />,
<AvatarFavicon name="test" data-testid="avatar-favicon" />,
);
expect(container.getElementsByClassName('mm-icon')).toHaveLength(1);
});
@ -34,6 +35,7 @@ describe('AvatarFavicon', () => {
it('should render fallback image with custom fallbackIconProps if no ImageSource is provided', () => {
const container = (
<AvatarFavicon
name="test"
data-testid="avatar-favicon"
fallbackIconProps={{
'data-testid': 'fallback-icon',
@ -96,6 +98,7 @@ describe('AvatarFavicon', () => {
const { getByTestId } = render(
<AvatarFavicon
className="mm-avatar-favicon--test"
name="test"
data-testid="classname"
{...args}
/>,

View File

@ -22,7 +22,8 @@ describe('HelpText', () => {
it('should render with react nodes inside the HelpText', () => {
const { getByText, getByTestId } = render(
<HelpText>
help text <Icon name={ICON_NAMES.WARNING} data-testid="icon" />
help text{' '}
<Icon name={ICON_NAMES.WARNING} data-testid="icon" as="span" />
</HelpText>,
);
expect(getByText('help text')).toBeDefined();

View File

@ -57,7 +57,11 @@ describe('PickerNetwork', () => {
// className
it('should render with custom className', () => {
const { getByTestId } = render(
<PickerNetwork data-testid="picker-network" className="test-class" />,
<PickerNetwork
data-testid="picker-network"
label="test"
className="test-class"
/>,
);
expect(getByTestId('picker-network')).toHaveClass('test-class');
});

View File

@ -43,7 +43,7 @@ export const TagUrl = ({
display={DISPLAY.FLEX}
{...props}
>
<AvatarFavicon src={src} {...avatarFaviconProps} />
<AvatarFavicon src={src} name={label} {...avatarFaviconProps} />
{showLockIcon && (
<Icon
className="mm-tag-url__lock-icon"
@ -58,7 +58,6 @@ export const TagUrl = ({
<Text variant={TextVariant.bodyMd} ellipsis {...labelProps}>
{label}
</Text>
{actionButtonLabel && (
<ButtonLink
as="a"