- it("communicates with <ContextMenu/>", () => {
- const onContextAction = jest.fn();
- const dataExplorer = mount(<DataExplorer
- {...mockDataExplorerProps()}
- contextActions={[]}
- onContextAction={onContextAction}
- items={["Item 1"]}
- columns={[{ name: "Column 1", render: jest.fn(), selected: true }]} />);
- expect(dataExplorer.find(ContextMenu).prop("actions")).toEqual([]);
- dataExplorer.find(DataTable).prop("onRowContextMenu")({
- preventDefault: jest.fn(),
- stopPropagation: jest.fn()
- }, "Item 1");
- dataExplorer.find(ContextMenu).prop("onActionClick")({ name: "Action 1", icon: "" });
- expect(onContextAction).toHaveBeenCalledWith({ name: "Action 1", icon: "" }, "Item 1");
- });
-