X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/9e4aa2fd44835698c0a3e6f321a2cf88b6f11939..a21b35b41a8e69a4a1e287ce069dbc65c5c534f2:/src/components/data-table/data-table.test.tsx

diff --git a/src/components/data-table/data-table.test.tsx b/src/components/data-table/data-table.test.tsx
index 115ca67f..439e6c27 100644
--- a/src/components/data-table/data-table.test.tsx
+++ b/src/components/data-table/data-table.test.tsx
@@ -4,10 +4,11 @@
 
 import * as React from "react";
 import { mount, configure } from "enzyme";
+import { TableHead, TableCell, Typography, TableBody, Button, TableSortLabel } from "@material-ui/core";
 import * as Adapter from "enzyme-adapter-react-16";
 import DataTable from "./data-table";
 import { DataColumn } from "./data-column";
-import { TableHead, TableCell, Typography, TableBody, Button, TableSortLabel } from "@material-ui/core";
+import DataTableFilters from "../data-table-filters/data-table-filters";
 
 configure({ adapter: new Adapter() });
 
@@ -159,5 +160,26 @@ describe("<DataTable />", () => {
         expect(onSortToggle).toHaveBeenCalledWith(columns[0]);
     });
 
+    it("passes filter props to <DataTableFilter />", () => {
+        const columns: Array<DataColumn<string>> = [{
+            name: "Column 1",
+            sortDirection: "asc",
+            selected: true,
+            filters: [{name: "Filter 1", selected: true}],
+            render: (item) => <Typography>{item}</Typography>
+        }];
+        const onFiltersChange = jest.fn();
+        const dataTable = mount(<DataTable 
+            columns={columns} 
+            items={["item 1"]} 
+            onFiltersChange={onFiltersChange}
+            onRowClick={jest.fn()}
+            onRowContextMenu={jest.fn()}
+            onSortToggle={jest.fn()}/>);
+        expect(dataTable.find(DataTableFilters).prop("filters")).toBe(columns[0].filters);
+        dataTable.find(DataTableFilters).prop("onChange")([]);
+        expect(onFiltersChange).toHaveBeenCalledWith([], columns[0]);
+    });
+
 
 });
\ No newline at end of file
