mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 12:56:01 +01:00
32 lines
881 B
JavaScript
32 lines
881 B
JavaScript
import React from 'react';
|
|
import { fireEvent } from '@testing-library/react';
|
|
import { renderWithProvider } from '../../../../test/lib/render-helpers';
|
|
import { DropdownMenuItem } from './dropdown';
|
|
|
|
describe('Dropdown', () => {
|
|
const props = {
|
|
onClick: jest.fn(),
|
|
closeMenu: jest.fn(),
|
|
style: { test: 'style' },
|
|
};
|
|
|
|
it('should matchsnapshot', () => {
|
|
const { container } = renderWithProvider(<DropdownMenuItem {...props} />);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
|
|
it('simulates click event and calls onClick and closeMenu', () => {
|
|
const { queryByTestId } = renderWithProvider(
|
|
<DropdownMenuItem {...props} />,
|
|
);
|
|
|
|
const dropdownItem = queryByTestId('dropdown-menu-item');
|
|
|
|
fireEvent.click(dropdownItem);
|
|
|
|
expect(props.onClick).toHaveBeenCalledTimes(1);
|
|
expect(props.closeMenu).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|