[arvados-workbench2] updated: 2.6.0-94-g773c4d49

git repository hosting git at public.arvados.org
Wed Sep 13 18:17:02 UTC 2023


Summary of changes:
 .../data-explorer/data-explorer.test.tsx           |  84 ++++---
 src/components/data-table/data-table.test.tsx      | 257 ++++++++++++---------
 src/components/data-table/data-table.tsx           |  21 +-
 3 files changed, 205 insertions(+), 157 deletions(-)

       via  773c4d491fdb5a6b228165e3ff2f62db7c1f2237 (commit)
       via  8efb99776ee267be4f626baef911408d1dda6429 (commit)
      from  e26fdc06a54e8b4fb7c22f78d335d02d2d7c3ea5 (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 773c4d491fdb5a6b228165e3ff2f62db7c1f2237
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Wed Sep 13 14:16:05 2023 -0400

    15768: last test Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/src/components/data-explorer/data-explorer.test.tsx b/src/components/data-explorer/data-explorer.test.tsx
index dc7e8725..4ba0eef9 100644
--- a/src/components/data-explorer/data-explorer.test.tsx
+++ b/src/components/data-explorer/data-explorer.test.tsx
@@ -4,29 +4,31 @@
 
 import React from "react";
 import { configure, mount } from "enzyme";
-import Adapter from 'enzyme-adapter-react-16';
+import Adapter from "enzyme-adapter-react-16";
 
-import { DataExplorer } from "./data-explorer";
+import { DataExplorer } from "./data-explorer"; //here
 import { ColumnSelector } from "../column-selector/column-selector";
 import { DataTable, DataTableFetchMode } from "../data-table/data-table";
 import { SearchInput } from "../search-input/search-input";
 import { TablePagination } from "@material-ui/core";
-import { ProjectIcon } from '../icon/icon';
-import { SortDirection } from '../data-table/data-column';
+import { ProjectIcon } from "../icon/icon";
+import { SortDirection } from "../data-table/data-column";
 
 configure({ adapter: new Adapter() });
 
 describe("<DataExplorer />", () => {
-
     it("communicates with <SearchInput/>", () => {
         const onSearch = jest.fn();
         const onSetColumns = jest.fn();
-        const dataExplorer = mount(<DataExplorer
-            {...mockDataExplorerProps()}
-            items={[{ name: "item 1" }]}
-            searchValue="search value"
-            onSearch={onSearch}
-            onSetColumns={onSetColumns} />);
+        const dataExplorer = mount(
+            <DataExplorer
+                {...mockDataExplorerProps()}
+                items={[{ name: "item 1" }]}
+                searchValue="search value"
+                onSearch={onSearch}
+                onSetColumns={onSetColumns}
+            />
+        );
         expect(dataExplorer.find(SearchInput).prop("value")).toEqual("search value");
         dataExplorer.find(SearchInput).prop("onSearch")("new value");
         expect(onSearch).toHaveBeenCalledWith("new value");
@@ -36,12 +38,15 @@ describe("<DataExplorer />", () => {
         const onColumnToggle = jest.fn();
         const onSetColumns = jest.fn();
         const columns = [{ name: "Column 1", render: jest.fn(), selected: true, configurable: true, sortDirection: SortDirection.ASC, filters: {} }];
-        const dataExplorer = mount(<DataExplorer
-            {...mockDataExplorerProps()}
-            columns={columns}
-            onColumnToggle={onColumnToggle}
-            items={[{ name: "item 1" }]}
-            onSetColumns={onSetColumns} />);
+        const dataExplorer = mount(
+            <DataExplorer
+                {...mockDataExplorerProps()}
+                columns={columns}
+                onColumnToggle={onColumnToggle}
+                items={[{ name: "item 1" }]}
+                onSetColumns={onSetColumns}
+            />
+        );
         expect(dataExplorer.find(ColumnSelector).prop("columns")).toBe(columns);
         dataExplorer.find(ColumnSelector).prop("onColumnToggle")("columns");
         expect(onColumnToggle).toHaveBeenCalledWith("columns");
@@ -54,15 +59,18 @@ describe("<DataExplorer />", () => {
         const onSetColumns = jest.fn();
         const columns = [{ name: "Column 1", render: jest.fn(), selected: true, configurable: true, sortDirection: SortDirection.ASC, filters: {} }];
         const items = [{ name: "item 1" }];
-        const dataExplorer = mount(<DataExplorer
-            {...mockDataExplorerProps()}
-            columns={columns}
-            items={items}
-            onFiltersChange={onFiltersChange}
-            onSortToggle={onSortToggle}
-            onRowClick={onRowClick}
-            onSetColumns={onSetColumns} />);
-        expect(dataExplorer.find(DataTable).prop("columns").slice(0, -1)).toEqual(columns);
+        const dataExplorer = mount(
+            <DataExplorer
+                {...mockDataExplorerProps()}
+                columns={columns}
+                items={items}
+                onFiltersChange={onFiltersChange}
+                onSortToggle={onSortToggle}
+                onRowClick={onRowClick}
+                onSetColumns={onSetColumns}
+            />
+        );
+        expect(dataExplorer.find(DataTable).prop("columns").slice(1, 2)).toEqual(columns);
         expect(dataExplorer.find(DataTable).prop("items")).toBe(items);
         dataExplorer.find(DataTable).prop("onRowClick")("event", "rowClick");
         dataExplorer.find(DataTable).prop("onFiltersChange")("filtersChange");
@@ -76,14 +84,17 @@ describe("<DataExplorer />", () => {
         const onChangePage = jest.fn();
         const onChangeRowsPerPage = jest.fn();
         const onSetColumns = jest.fn();
-        const dataExplorer = mount(<DataExplorer
-            {...mockDataExplorerProps()}
-            items={[{ name: "item 1" }]}
-            page={10}
-            rowsPerPage={50}
-            onChangePage={onChangePage}
-            onChangeRowsPerPage={onChangeRowsPerPage}
-            onSetColumns={onSetColumns} />);
+        const dataExplorer = mount(
+            <DataExplorer
+                {...mockDataExplorerProps()}
+                items={[{ name: "item 1" }]}
+                page={10}
+                rowsPerPage={50}
+                onChangePage={onChangePage}
+                onChangeRowsPerPage={onChangeRowsPerPage}
+                onSetColumns={onSetColumns}
+            />
+        );
         expect(dataExplorer.find(TablePagination).prop("page")).toEqual(10);
         expect(dataExplorer.find(TablePagination).prop("rowsPerPage")).toEqual(50);
         dataExplorer.find(TablePagination).prop("onChangePage")(undefined, 6);
@@ -115,6 +126,7 @@ const mockDataExplorerProps = () => ({
     defaultIcon: ProjectIcon,
     onSetColumns: jest.fn(),
     onLoadMore: jest.fn(),
-    defaultMessages: ['testing'],
-    contextMenuColumn: true
+    defaultMessages: ["testing"],
+    contextMenuColumn: true,
+    setCheckedListOnStore: jest.fn(),
 });

commit 8efb99776ee267be4f626baef911408d1dda6429
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Tue Sep 12 15:48:18 2023 -0400

    15768: all but one test passing Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/src/components/data-table/data-table.test.tsx b/src/components/data-table/data-table.test.tsx
index a72056d1..880868bd 100644
--- a/src/components/data-table/data-table.test.tsx
+++ b/src/components/data-table/data-table.test.tsx
@@ -4,13 +4,13 @@
 
 import React from "react";
 import { mount, configure } from "enzyme";
-import { pipe } from 'lodash/fp';
+import { pipe } from "lodash/fp";
 import { TableHead, TableCell, Typography, TableBody, Button, TableSortLabel } from "@material-ui/core";
 import Adapter from "enzyme-adapter-react-16";
 import { DataTable, DataColumns } from "./data-table";
 import { SortDirection, createDataColumn } from "./data-column";
-import { DataTableFiltersPopover } from 'components/data-table-filters/data-table-filters-popover';
-import { createTree, setNode, initTreeNode } from 'models/tree';
+import { DataTableFiltersPopover } from "components/data-table-filters/data-table-filters-popover";
+import { createTree, setNode, initTreeNode } from "models/tree";
 import { DataTableFilterItem } from "components/data-table-filters/data-table-filters-tree";
 
 configure({ adapter: new Adapter() });
@@ -22,30 +22,34 @@ describe("<DataTable />", () => {
                 name: "Column 1",
                 render: () => <span />,
                 selected: true,
-                configurable: true
+                configurable: true,
             }),
             createDataColumn({
                 name: "Column 2",
                 render: () => <span />,
                 selected: true,
-                configurable: true
+                configurable: true,
             }),
             createDataColumn({
                 name: "Column 3",
                 render: () => <span />,
                 selected: false,
-                configurable: true
+                configurable: true,
             }),
         ];
-        const dataTable = mount(<DataTable
-            columns={columns}
-            items={[{ key: "1", name: "item 1" }]}
-            onFiltersChange={jest.fn()}
-            onRowClick={jest.fn()}
-            onRowDoubleClick={jest.fn()}
-            onContextMenu={jest.fn()}
-            onSortToggle={jest.fn()} />);
-        expect(dataTable.find(TableHead).find(TableCell)).toHaveLength(2);
+        const dataTable = mount(
+            <DataTable
+                columns={columns}
+                items={[{ key: "1", name: "item 1" }]}
+                onFiltersChange={jest.fn()}
+                onRowClick={jest.fn()}
+                onRowDoubleClick={jest.fn()}
+                onContextMenu={jest.fn()}
+                onSortToggle={jest.fn()}
+                setCheckedListOnStore={jest.fn()}
+            />
+        );
+        expect(dataTable.find(TableHead).find(TableCell)).toHaveLength(3);
     });
 
     it("renders column name", () => {
@@ -54,18 +58,22 @@ describe("<DataTable />", () => {
                 name: "Column 1",
                 render: () => <span />,
                 selected: true,
-                configurable: true
+                configurable: true,
             }),
         ];
-        const dataTable = mount(<DataTable
-            columns={columns}
-            items={["item 1"]}
-            onFiltersChange={jest.fn()}
-            onRowClick={jest.fn()}
-            onRowDoubleClick={jest.fn()}
-            onContextMenu={jest.fn()}
-            onSortToggle={jest.fn()} />);
-        expect(dataTable.find(TableHead).find(TableCell).text()).toBe("Column 1");
+        const dataTable = mount(
+            <DataTable
+                columns={columns}
+                items={["item 1"]}
+                onFiltersChange={jest.fn()}
+                onRowClick={jest.fn()}
+                onRowDoubleClick={jest.fn()}
+                onContextMenu={jest.fn()}
+                onSortToggle={jest.fn()}
+                setCheckedListOnStore={jest.fn()}
+            />
+        );
+        expect(dataTable.find(TableHead).find(TableCell).last().text()).toBe("Column 1");
     });
 
     it("uses renderHeader instead of name prop", () => {
@@ -75,18 +83,22 @@ describe("<DataTable />", () => {
                 renderHeader: () => <span>Column Header</span>,
                 render: () => <span />,
                 selected: true,
-                configurable: true
+                configurable: true,
             }),
         ];
-        const dataTable = mount(<DataTable
-            columns={columns}
-            items={[]}
-            onFiltersChange={jest.fn()}
-            onRowClick={jest.fn()}
-            onRowDoubleClick={jest.fn()}
-            onContextMenu={jest.fn()}
-            onSortToggle={jest.fn()} />);
-        expect(dataTable.find(TableHead).find(TableCell).text()).toBe("Column Header");
+        const dataTable = mount(
+            <DataTable
+                columns={columns}
+                items={[]}
+                onFiltersChange={jest.fn()}
+                onRowClick={jest.fn()}
+                onRowDoubleClick={jest.fn()}
+                onContextMenu={jest.fn()}
+                onSortToggle={jest.fn()}
+                setCheckedListOnStore={jest.fn()}
+            />
+        );
+        expect(dataTable.find(TableHead).find(TableCell).last().text()).toBe("Column Header");
     });
 
     it("passes column key prop to corresponding cells", () => {
@@ -96,116 +108,137 @@ describe("<DataTable />", () => {
                 key: "column-1-key",
                 render: () => <span />,
                 selected: true,
-                configurable: true
-            })
+                configurable: true,
+            }),
         ];
-        const dataTable = mount(<DataTable
-            columns={columns}
-            working={false}
-            items={["item 1"]}
-            onFiltersChange={jest.fn()}
-            onRowClick={jest.fn()}
-            onRowDoubleClick={jest.fn()}
-            onContextMenu={jest.fn()}
-            onSortToggle={jest.fn()} />);
-        expect(dataTable.find(TableHead).find(TableCell).key()).toBe("column-1-key");
-        expect(dataTable.find(TableBody).find(TableCell).key()).toBe("column-1-key");
+        const dataTable = mount(
+            <DataTable
+                columns={columns}
+                working={false}
+                items={["item 1"]}
+                onFiltersChange={jest.fn()}
+                onRowClick={jest.fn()}
+                onRowDoubleClick={jest.fn()}
+                onContextMenu={jest.fn()}
+                onSortToggle={jest.fn()}
+                setCheckedListOnStore={jest.fn()}
+            />
+        );
+        expect(dataTable.find(TableBody).find(TableCell).last().key()).toBe("column-1-key");
     });
 
     it("renders items", () => {
         const columns: DataColumns<string, string> = [
             createDataColumn({
                 name: "Column 1",
-                render: (item) => <Typography>{item}</Typography>,
+                render: item => <Typography>{item}</Typography>,
                 selected: true,
-                configurable: true
+                configurable: true,
             }),
             createDataColumn({
                 name: "Column 2",
-                render: (item) => <Button>{item}</Button>,
+                render: item => <Button>{item}</Button>,
                 selected: true,
-                configurable: true
-            })
+                configurable: true,
+            }),
         ];
-        const dataTable = mount(<DataTable
-            columns={columns}
-            working={false}
-            items={["item 1"]}
-            onFiltersChange={jest.fn()}
-            onRowClick={jest.fn()}
-            onRowDoubleClick={jest.fn()}
-            onContextMenu={jest.fn()}
-            onSortToggle={jest.fn()} />);
-        expect(dataTable.find(TableBody).find(Typography).text()).toBe("item 1");
-        expect(dataTable.find(TableBody).find(Button).text()).toBe("item 1");
+        const dataTable = mount(
+            <DataTable
+                columns={columns}
+                working={false}
+                items={["item 1"]}
+                onFiltersChange={jest.fn()}
+                onRowClick={jest.fn()}
+                onRowDoubleClick={jest.fn()}
+                onContextMenu={jest.fn()}
+                onSortToggle={jest.fn()}
+                setCheckedListOnStore={jest.fn()}
+            />
+        );
+        expect(dataTable.find(TableBody).find(Typography).last().text()).toBe("item 1");
+        expect(dataTable.find(TableBody).find(Button).last().text()).toBe("item 1");
     });
 
     it("passes sorting props to <TableSortLabel />", () => {
         const columns: DataColumns<string, string> = [
             createDataColumn({
                 name: "Column 1",
-                sort: {direction: SortDirection.ASC, field: "length"},
+                sort: { direction: SortDirection.ASC, field: "length" },
                 selected: true,
                 configurable: true,
-                render: (item) => <Typography>{item}</Typography>
-            })];
+                render: item => <Typography>{item}</Typography>,
+            }),
+        ];
         const onSortToggle = jest.fn();
-        const dataTable = mount(<DataTable
-            columns={columns}
-            items={["item 1"]}
-            onFiltersChange={jest.fn()}
-            onRowClick={jest.fn()}
-            onRowDoubleClick={jest.fn()}
-            onContextMenu={jest.fn()}
-            onSortToggle={onSortToggle} />);
+        const dataTable = mount(
+            <DataTable
+                columns={columns}
+                items={["item 1"]}
+                onFiltersChange={jest.fn()}
+                onRowClick={jest.fn()}
+                onRowDoubleClick={jest.fn()}
+                onContextMenu={jest.fn()}
+                onSortToggle={onSortToggle}
+                setCheckedListOnStore={jest.fn()}
+            />
+        );
         expect(dataTable.find(TableSortLabel).prop("active")).toBeTruthy();
         dataTable.find(TableSortLabel).at(0).simulate("click");
-        expect(onSortToggle).toHaveBeenCalledWith(columns[0]);
+        expect(onSortToggle).toHaveBeenCalledWith(columns[1]);
     });
 
     it("does not display <DataTableFiltersPopover /> if there is no filters provided", () => {
-        const columns: DataColumns<string, string> = [{
-            name: "Column 1",
-            selected: true,
-            configurable: true,
-            filters: [],
-            render: (item) => <Typography>{item}</Typography>
-        }];
+        const columns: DataColumns<string, string> = [
+            {
+                name: "Column 1",
+                selected: true,
+                configurable: true,
+                filters: [],
+                render: item => <Typography>{item}</Typography>,
+            },
+        ];
         const onFiltersChange = jest.fn();
-        const dataTable = mount(<DataTable
-            columns={columns}
-            items={[]}
-            onFiltersChange={onFiltersChange}
-            onRowClick={jest.fn()}
-            onRowDoubleClick={jest.fn()}
-            onSortToggle={jest.fn()}
-            onContextMenu={jest.fn()} />);
+        const dataTable = mount(
+            <DataTable
+                columns={columns}
+                items={[]}
+                onFiltersChange={onFiltersChange}
+                onRowClick={jest.fn()}
+                onRowDoubleClick={jest.fn()}
+                onSortToggle={jest.fn()}
+                onContextMenu={jest.fn()}
+                setCheckedListOnStore={jest.fn()}
+            />
+        );
         expect(dataTable.find(DataTableFiltersPopover)).toHaveLength(0);
     });
 
     it("passes filter props to <DataTableFiltersPopover />", () => {
-        const filters = pipe(
-            () => createTree<DataTableFilterItem>(),
-            setNode(initTreeNode({ id: 'filter', value: { name: 'filter' } }))
-        );
-        const columns: DataColumns<string, string> = [{
-            name: "Column 1",
-            selected: true,
-            configurable: true,
-            filters: filters(),
-            render: (item) => <Typography>{item}</Typography>
-        }];
+        const filters = pipe(() => createTree<DataTableFilterItem>(), setNode(initTreeNode({ id: "filter", value: { name: "filter" } })));
+        const columns: DataColumns<string, string> = [
+            {
+                name: "Column 1",
+                selected: true,
+                configurable: true,
+                filters: filters(),
+                render: item => <Typography>{item}</Typography>,
+            },
+        ];
         const onFiltersChange = jest.fn();
-        const dataTable = mount(<DataTable
-            columns={columns}
-            items={[]}
-            onFiltersChange={onFiltersChange}
-            onRowClick={jest.fn()}
-            onRowDoubleClick={jest.fn()}
-            onSortToggle={jest.fn()}
-            onContextMenu={jest.fn()} />);
-        expect(dataTable.find(DataTableFiltersPopover).prop("filters")).toBe(columns[0].filters);
+        const dataTable = mount(
+            <DataTable
+                columns={columns}
+                items={[]}
+                onFiltersChange={onFiltersChange}
+                onRowClick={jest.fn()}
+                onRowDoubleClick={jest.fn()}
+                onSortToggle={jest.fn()}
+                onContextMenu={jest.fn()}
+                setCheckedListOnStore={jest.fn()}
+            />
+        );
+        expect(dataTable.find(DataTableFiltersPopover).prop("filters")).toBe(columns[1].filters);
         dataTable.find(DataTableFiltersPopover).prop("onChange")([]);
-        expect(onFiltersChange).toHaveBeenCalledWith([], columns[0]);
+        expect(onFiltersChange).toHaveBeenCalledWith([], columns[1]);
     });
 });
diff --git a/src/components/data-table/data-table.tsx b/src/components/data-table/data-table.tsx
index a07a178e..59e15413 100644
--- a/src/components/data-table/data-table.tsx
+++ b/src/components/data-table/data-table.tsx
@@ -162,15 +162,18 @@ export const DataTable = withStyles(styles)(
             selected: true,
             configurable: false,
             filters: createTree(),
-            render: uuid => (
-                <input
-                    type="checkbox"
-                    name={uuid}
-                    className={this.props.classes.checkBox}
-                    checked={this.props.checkedList[uuid] ?? false}
-                    onChange={() => this.handleSelectOne(uuid)}
-                    onDoubleClick={ev => ev.stopPropagation()}></input>
-            ),
+            render: uuid => {
+                const { classes, checkedList } = this.props;
+                return (
+                    <input
+                        type="checkbox"
+                        name={uuid}
+                        className={classes.checkBox}
+                        checked={checkedList ? checkedList[uuid] : false}
+                        onChange={() => this.handleSelectOne(uuid)}
+                        onDoubleClick={ev => ev.stopPropagation()}></input>
+                );
+            },
         };
 
         multiselectOptions: DataTableMultiselectOption[] = [

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list