[ARVADOS-WORKBENCH2] updated: 1.1.4-127-ge2ea135

Git user git at public.curoverse.com
Thu Jun 21 10:37:02 EDT 2018


Summary of changes:
 .../data-explorer/data-explorer.test.tsx           | 54 ++++++++++++++--------
 1 file changed, 35 insertions(+), 19 deletions(-)

       via  e2ea1359533664ead0ae9b810fe56bf518846c78 (commit)
      from  ac57fa77b04d290285388036f7929631e05965e4 (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 e2ea1359533664ead0ae9b810fe56bf518846c78
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Thu Jun 21 16:36:48 2018 +0200

    Add search input communication test, fix context menu communication  test
    
    Feature #13633
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/data-explorer/data-explorer.test.tsx b/src/components/data-explorer/data-explorer.test.tsx
index 88481ce..8ced6cb 100644
--- a/src/components/data-explorer/data-explorer.test.tsx
+++ b/src/components/data-explorer/data-explorer.test.tsx
@@ -10,6 +10,7 @@ import DataExplorer from "./data-explorer";
 import ContextMenu from "../context-menu/context-menu";
 import ColumnSelector from "../column-selector/column-selector";
 import DataTable from "../data-table/data-table";
+import SearchInput from "../search-input/search-input";
 
 configure({ adapter: new Adapter() });
 
@@ -17,39 +18,44 @@ describe("<DataExplorer />", () => {
     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 }]}
-            onColumnToggle={jest.fn()}
-            onFiltersChange={jest.fn()}
-            onRowClick={jest.fn()}
-            onSortToggle={jest.fn()} />);
-
+            columns={[{ name: "Column 1", render: jest.fn(), selected: true }]} />);
         expect(dataExplorer.find(ContextMenu).prop("actions")).toEqual([]);
-        dataExplorer.setState({ contextMenu: { item: "Item 1" } });
+        dataExplorer.find(DataTable).prop("onRowContextMenu")({
+            preventDefault: jest.fn()
+        }, "Item 1");
         dataExplorer.find(ContextMenu).prop("onActionClick")({ name: "Action 1", icon: "" });
         expect(onContextAction).toHaveBeenCalledWith({ name: "Action 1", icon: "" }, "Item 1");
     });
     
+    it("communicates with <SearchInput/>", () => {
+        const onSearch = jest.fn();
+        const dataExplorer = mount(<DataExplorer
+            {...mockDataExplorerProps()}
+            searchValue="search value"
+            onSearch={onSearch}/>);
+        expect(dataExplorer.find(SearchInput).prop("value")).toEqual("search value");
+        dataExplorer.find(SearchInput).prop("onSearch")("new value");
+        expect(onSearch).toHaveBeenCalledWith("new value");
+    });
+
     it("communicates with <ColumnSelector/>", () => {
         const onColumnToggle = jest.fn();
         const columns = [{ name: "Column 1", render: jest.fn(), selected: true }];
         const dataExplorer = mount(<DataExplorer
+            {...mockDataExplorerProps()}
             columns={columns}
             onColumnToggle={onColumnToggle}
             contextActions={[]}
-            onContextAction={jest.fn()}
-            items={["Item 1"]}
-            onFiltersChange={jest.fn()}
-            onRowClick={jest.fn()}
-            onSortToggle={jest.fn()} />);
-
+            items={["Item 1"]} />);
         expect(dataExplorer.find(ColumnSelector).prop("columns")).toBe(columns);
         dataExplorer.find(ColumnSelector).prop("onColumnToggle")("columns");
         expect(onColumnToggle).toHaveBeenCalledWith("columns");
     });
-    
+
     it("communicates with <DataTable/>", () => {
         const onFiltersChange = jest.fn();
         const onSortToggle = jest.fn();
@@ -57,15 +63,12 @@ describe("<DataExplorer />", () => {
         const columns = [{ name: "Column 1", render: jest.fn(), selected: true }];
         const items = ["Item 1"];
         const dataExplorer = mount(<DataExplorer
+            {...mockDataExplorerProps()}
             columns={columns}
             items={items}
             onFiltersChange={onFiltersChange}
             onSortToggle={onSortToggle}
-            onRowClick={onRowClick}
-            onColumnToggle={jest.fn()}
-            contextActions={[]}
-            onContextAction={jest.fn()} />);
-
+            onRowClick={onRowClick} />);
         expect(dataExplorer.find(DataTable).prop("columns")).toBe(columns);
         expect(dataExplorer.find(DataTable).prop("items")).toBe(items);
         dataExplorer.find(DataTable).prop("onRowClick")("event", "rowClick");
@@ -75,4 +78,17 @@ describe("<DataExplorer />", () => {
         expect(onSortToggle).toHaveBeenCalledWith("sortToggle");
         expect(onRowClick).toHaveBeenCalledWith("rowClick");
     });
+});
+
+const mockDataExplorerProps = () => ({
+    columns: [],
+    items: [],
+    contextActions: [],
+    searchValue: "",
+    onSearch: jest.fn(),
+    onFiltersChange: jest.fn(),
+    onSortToggle: jest.fn(),
+    onRowClick: jest.fn(),
+    onColumnToggle: jest.fn(),
+    onContextAction: jest.fn()
 });
\ No newline at end of file

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list