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";
11 configure({ adapter: new Adapter() });
13 describe("<ContextMenu />", () => {
37 it("calls provided actions with provided item", () => {
38 const contextMenu = mount(<ContextMenu
39 anchorEl={document.createElement("div")}
41 {...{ actions, item }} />);
43 contextMenu.find(ListItem).at(0).simulate("click");
44 contextMenu.find(ListItem).at(1).simulate("click");
45 contextMenu.find(ListItem).at(2).simulate("click");
47 expect(actions[0][0].onClick).toHaveBeenCalledWith(item);
48 expect(actions[0][1].onClick).toHaveBeenCalledWith(item);
49 expect(actions[1][0].onClick).toHaveBeenCalledWith(item);