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 />", () => {
25 it("calls onActionClick with clicked action", () => {
26 const onActionClick = jest.fn();
27 const contextMenu = mount(<ContextMenu
28 anchorEl={document.createElement("div")}
30 onActionClick={onActionClick}
31 actions={actions} />);
32 contextMenu.find(ListItem).at(2).simulate("click");
33 expect(onActionClick).toHaveBeenCalledWith(actions[1][0]);