mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
4f8c4820d2
* adding badges for nfts * fixing default nft styling issue * adding multichain flag, making borderRadius inline * Apply suggestions from code review Co-authored-by: George Marshall <george.marshall@consensys.net> * fixing imports * removing nullcheck for guaranteed fields * moving badgewrapper UI into multichain component * using Box for button, removing inline style, border-radius for NFT default image * adding nft badges to NFT Details page * nits, snap update * fixing/refactoring nftdefaultimage display, adding clickable, removing handleimageclick, refactor NFTItem, required props * editing nft-default-image story, test, and snap * Updating to fix positioning, use Box props to reduce CSS and BEM naming conventions * moving minor styling to Box props, adding comment * display block typo --------- Co-authored-by: George Marshall <george.marshall@consensys.net>
74 lines
2.0 KiB
JavaScript
74 lines
2.0 KiB
JavaScript
import React from 'react';
|
|
import { renderWithProvider } from '../../../../test/lib/render-helpers';
|
|
import NftDefaultImage from '.';
|
|
|
|
describe('NFT Default Image', () => {
|
|
it('should render with no props', () => {
|
|
const { container } = renderWithProvider(<NftDefaultImage />);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
it('should match snapshot with all provided props', () => {
|
|
const props = {
|
|
name: 'NFT Name',
|
|
tokenId: '123',
|
|
clickable: true,
|
|
};
|
|
|
|
const { container } = renderWithProvider(<NftDefaultImage {...props} />);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
it('should match snapshot with missing clickable prop', () => {
|
|
const props = {
|
|
name: 'NFT Name',
|
|
tokenId: '123',
|
|
};
|
|
|
|
const { container } = renderWithProvider(<NftDefaultImage {...props} />);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
it('should render NFT name', () => {
|
|
const props = {
|
|
name: 'NFT Name',
|
|
};
|
|
|
|
const { queryByText } = renderWithProvider(<NftDefaultImage {...props} />);
|
|
|
|
const nftElement = queryByText(`${props.name} #`);
|
|
|
|
expect(nftElement).toBeInTheDocument();
|
|
});
|
|
|
|
it('should render NFT name and tokenId', () => {
|
|
const props = {
|
|
name: 'NFT Name',
|
|
tokenId: '123',
|
|
};
|
|
|
|
const { queryByText } = renderWithProvider(<NftDefaultImage {...props} />);
|
|
|
|
const nftElement = queryByText(`${props.name} #${props.tokenId}`);
|
|
|
|
expect(nftElement).toBeInTheDocument();
|
|
});
|
|
|
|
it('does not render component with clickable class when clickable is false', () => {
|
|
const { container } = renderWithProvider(
|
|
<NftDefaultImage name="NFT Name" tokenId="123" clickable={false} />,
|
|
);
|
|
expect(container.firstChild).not.toHaveClass('nft-default--clickable');
|
|
});
|
|
|
|
it('renders component with clickable class when clickable is true', () => {
|
|
const { container } = renderWithProvider(
|
|
<NftDefaultImage name="NFT Name" tokenId="123" clickable />,
|
|
);
|
|
expect(container.firstChild).toHaveClass('nft-default--clickable');
|
|
});
|
|
});
|