X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/3eaf143e04107bf25e15aaef4d1b4d5d7ef68f86..fe979f4143a71d7951dcfa35c9fdf68841742c74:/src/components/data-explorer/data-explorer.test.tsx
diff --git a/src/components/data-explorer/data-explorer.test.tsx b/src/components/data-explorer/data-explorer.test.tsx
index d2ca7f7b..97b1bec6 100644
--- a/src/components/data-explorer/data-explorer.test.tsx
+++ b/src/components/data-explorer/data-explorer.test.tsx
@@ -12,6 +12,7 @@ import ColumnSelector from "../column-selector/column-selector";
import DataTable from "../data-table/data-table";
import SearchInput from "../search-input/search-input";
import { TablePagination } from "@material-ui/core";
+import { MockItem } from "../data-table/data-table.test";
configure({ adapter: new Adapter() });
@@ -21,13 +22,12 @@ describe("", () => {
const onContextAction = jest.fn();
const dataExplorer = mount();
expect(dataExplorer.find(ContextMenu).prop("actions")).toEqual([]);
dataExplorer.find(DataTable).prop("onRowContextMenu")({
- preventDefault: jest.fn()
+ 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");
@@ -37,7 +37,7 @@ describe("", () => {
const onSearch = jest.fn();
const dataExplorer = mount();
expect(dataExplorer.find(SearchInput).prop("value")).toEqual("search value");
@@ -52,8 +52,7 @@ describe("", () => {
{...mockDataExplorerProps()}
columns={columns}
onColumnToggle={onColumnToggle}
- contextActions={[]}
- items={["Item 1"]} />);
+ items={[{ key: "1", name: "item 1" }] as MockItem[]} />);
expect(dataExplorer.find(ColumnSelector).prop("columns")).toBe(columns);
dataExplorer.find(ColumnSelector).prop("onColumnToggle")("columns");
expect(onColumnToggle).toHaveBeenCalledWith("columns");
@@ -64,7 +63,7 @@ describe("", () => {
const onSortToggle = jest.fn();
const onRowClick = jest.fn();
const columns = [{ name: "Column 1", render: jest.fn(), selected: true }];
- const items = ["Item 1"];
+ const items = [{ key: "1", name: "item 1" }] as MockItem[];
const dataExplorer = mount(", () => {
expect(onRowClick).toHaveBeenCalledWith("rowClick");
});
- it("does not render , and if there is no items", () => {
+ it("does not render if there is no items", () => {
const dataExplorer = mount();
- expect(dataExplorer.find(SearchInput)).toHaveLength(0);
expect(dataExplorer.find(TablePagination)).toHaveLength(0);
});
@@ -96,7 +94,7 @@ describe("", () => {
const onChangeRowsPerPage = jest.fn();
const dataExplorer = mount(", () => {
const mockDataExplorerProps = () => ({
columns: [],
items: [],
+ itemsAvailable: 0,
contextActions: [],
searchValue: "",
page: 0,
@@ -123,7 +122,7 @@ const mockDataExplorerProps = () => ({
onSortToggle: jest.fn(),
onRowClick: jest.fn(),
onColumnToggle: jest.fn(),
- onContextAction: jest.fn(),
onChangePage: jest.fn(),
- onChangeRowsPerPage: jest.fn()
+ onChangeRowsPerPage: jest.fn(),
+ onContextMenu: jest.fn()
});
\ No newline at end of file