Merge branch '13834-update-icons-in-context-menu'
[arvados-workbench2.git] / src / components / context-menu / context-menu.test.tsx
index e4e2397da280ae7ddfa20d9a7a6ed816c5c83c80..95a219f98a9cfc6347bda2a80de1aa4cc3bc6550 100644 (file)
@@ -7,29 +7,30 @@ import { mount, configure, shallow } from "enzyme";
 import * as Adapter from "enzyme-adapter-react-16";
 import ContextMenu from "./context-menu";
 import { ListItem } from "@material-ui/core";
+import { ShareIcon } from "../icon/icon";
 
 configure({ adapter: new Adapter() });
 
 describe("<ContextMenu />", () => {
-    const actions = [[{
-        icon: "",
+    const items = [[{
+        icon: ShareIcon,
         name: "Action 1.1"
     }, {
-        icon: "",
+        icon: ShareIcon,
         name: "Action 1.2"
     },], [{
-        icon: "",
+        icon: ShareIcon,
         name: "Action 2.1"
     }]];
 
-    it("calls onActionClick with clicked action", () => {
-        const onActionClick = jest.fn();
+    it("calls onItemClick with clicked action", () => {
+        const onItemClick = jest.fn();
         const contextMenu = mount(<ContextMenu
             anchorEl={document.createElement("div")}
             onClose={jest.fn()}
-            onActionClick={onActionClick}
-            actions={actions} />);
+            onItemClick={onItemClick}
+            items={items} />);
         contextMenu.find(ListItem).at(2).simulate("click");
-        expect(onActionClick).toHaveBeenCalledWith(actions[1][0]);
+        expect(onItemClick).toHaveBeenCalledWith(items[1][0]);
     });
 });
\ No newline at end of file