[ARVADOS-WORKBENCH2] updated: 1.1.4-124-ga21b35b

Git user git at public.curoverse.com
Thu Jun 21 06:03:53 EDT 2018


Summary of changes:
 src/components/data-table/data-table.test.tsx | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

       via  a21b35b41a8e69a4a1e287ce069dbc65c5c534f2 (commit)
      from  9e4aa2fd44835698c0a3e6f321a2cf88b6f11939 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit a21b35b41a8e69a4a1e287ce069dbc65c5c534f2
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Thu Jun 21 12:03:36 2018 +0200

    Add data table test for filters
    
    Feature #13633
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/data-table/data-table.test.tsx b/src/components/data-table/data-table.test.tsx
index 115ca67..439e6c2 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

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list