Hide search input and column selector when there is no items
[arvados-workbench2.git] / src / components / data-explorer / data-explorer.test.tsx
index 152d03697040687d9cee7afe3a715a542a6d3d61..eff4992311135dbad8d3fb04d8c767e6524a7f7a 100644 (file)
@@ -37,6 +37,7 @@ describe("<DataExplorer />", () => {
         const onSearch = jest.fn();
         const dataExplorer = mount(<DataExplorer
             {...mockDataExplorerProps()}
+            items={["item 1"]}
             searchValue="search value"
             onSearch={onSearch} />);
         expect(dataExplorer.find(SearchInput).prop("value")).toEqual("search value");
@@ -81,14 +82,14 @@ describe("<DataExplorer />", () => {
         expect(onRowClick).toHaveBeenCalledWith("rowClick");
     });
 
-    it("renders <TablePagination/> if items list is not empty", () => {
-        const onChangePage = jest.fn();
-        const onChangeRowsPerPage = jest.fn();
+    it("does not render <SearchInput/>, <ColumnSelector/> and <TablePagination/> if there is no items", () => {
         const dataExplorer = mount(<DataExplorer
             {...mockDataExplorerProps()}
-            items={["Item 1"]}
+            items={[]}
         />);
-        expect(dataExplorer.find(TablePagination)).toHaveLength(1);
+        expect(dataExplorer.find(SearchInput)).toHaveLength(0);
+        expect(dataExplorer.find(ColumnSelector)).toHaveLength(0);
+        expect(dataExplorer.find(TablePagination)).toHaveLength(0);
     });
 
     it("communicates with <TablePagination/>", () => {