1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import { mount, configure, shallow } from "enzyme";
7 import * as Adapter from "enzyme-adapter-react-16";
8 import ContextMenu from "./context-menu";
9 import { ListItem } from "@material-ui/core";
10 import { IconTypes } from "../icon/icon";
12 configure({ adapter: new Adapter() });
14 describe("<ContextMenu />", () => {
16 icon: IconTypes.ANNOUNCEMENT,
19 icon: IconTypes.ANNOUNCEMENT,
22 icon: IconTypes.ANNOUNCEMENT,
26 it("calls onItemClick with clicked action", () => {
27 const onItemClick = jest.fn();
28 const contextMenu = mount(<ContextMenu
29 anchorEl={document.createElement("div")}
31 onItemClick={onItemClick}
33 contextMenu.find(ListItem).at(2).simulate("click");
34 expect(onItemClick).toHaveBeenCalledWith(items[1][0]);