mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
4dcde1e216
* layout wip * Icon changes, add badgewrapped icons to smart tx * grouping by date wip * typo fix * group txs by date, button styling * removing queue/history division, adding datestamp for pending tx, minor styling changes * adding tests, updating snap * font size fix * e2e fixes * Remove unnecessary tabIndex and keypress handler * Fix typo for fontWeight * Fix nesting warning by removing unnecessary Text * Fix tests * Fix import and exports * Remove unused verbiage * Update E2E selectors * More E2E * More E2Es * More test fixes * awaiting find instead of click * adding regularDelayMs to flaky test * removing delay * increasing delay outside of wait * adding back first-child to selector * test fixes * using datatestid for primary currency * sorting date txgroups * wip alignment for big numbers * alignment issues fix * lintfix * adding tabindex, cursor pointer, updating snap * unit test fix * storybook additions * snaphot update * update snap --------- Co-authored-by: David Walsh <davidwalsh83@gmail.com>
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
import React from 'react';
|
|
import { render, fireEvent } from '@testing-library/react';
|
|
import { Icon, IconName, IconSize } from '../../component-library';
|
|
import { ActivityListItem } from './activity-list-item';
|
|
|
|
const TITLE = 'Hello World';
|
|
const SUBTITLE = <p>I am a list item</p>;
|
|
const CLASSNAME = 'list-item-test';
|
|
const RIGHT_CONTENT = <p>Content rendered to the right</p>;
|
|
const CHILDREN = <button>I am a button</button>;
|
|
const MID_CONTENT = <p>Content rendered in the middle</p>;
|
|
const TOP_CONTENT = <p>Content rendered at the top</p>;
|
|
|
|
describe('ActivityListItem', () => {
|
|
const defaultProps = {
|
|
className: CLASSNAME,
|
|
title: TITLE,
|
|
'data-testid': 'test-id',
|
|
subtitle: SUBTITLE,
|
|
rightContent: RIGHT_CONTENT,
|
|
midContent: MID_CONTENT,
|
|
topContent: TOP_CONTENT,
|
|
icon: <Icon name={IconName.Custody} size={IconSize.Xs} />,
|
|
onClick: jest.fn(),
|
|
};
|
|
|
|
it('should match snapshot with no props', () => {
|
|
const { container } = render(<ActivityListItem />);
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
it('should match snapshot with props', () => {
|
|
const { container } = render(
|
|
<ActivityListItem {...defaultProps}>{CHILDREN}</ActivityListItem>,
|
|
);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
it('calls onClick when clicked', () => {
|
|
const { getByTestId } = render(<ActivityListItem {...defaultProps} />);
|
|
fireEvent.click(getByTestId('test-id'));
|
|
expect(defaultProps.onClick).toHaveBeenCalled();
|
|
});
|
|
});
|