+
+ it("communicates with <TablePagination/>", () => {
+ 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} />);
+ expect(dataExplorer.find(TablePagination).prop("page")).toEqual(10);
+ expect(dataExplorer.find(TablePagination).prop("rowsPerPage")).toEqual(50);
+ dataExplorer.find(TablePagination).prop("onChangePage")(undefined, 6);
+ dataExplorer.find(TablePagination).prop("onChangeRowsPerPage")({ target: { value: 10 } });
+ expect(onChangePage).toHaveBeenCalledWith(6);
+ expect(onChangeRowsPerPage).toHaveBeenCalledWith(10);
+ });
+});
+
+const mockDataExplorerProps = () => ({
+ fetchMode: DataTableFetchMode.PAGINATED,
+ columns: [],
+ items: [],
+ itemsAvailable: 0,
+ contextActions: [],
+ searchValue: "",
+ page: 0,
+ rowsPerPage: 0,
+ rowsPerPageOptions: [0],
+ onSearch: jest.fn(),
+ onFiltersChange: jest.fn(),
+ onSortToggle: jest.fn(),
+ onRowClick: jest.fn(),
+ onRowDoubleClick: jest.fn(),
+ onColumnToggle: jest.fn(),
+ onChangePage: jest.fn(),
+ onChangeRowsPerPage: jest.fn(),
+ onContextMenu: jest.fn(),
+ defaultIcon: ProjectIcon,
+ onSetColumns: jest.fn(),
+ onLoadMore: jest.fn(),
+ defaultMessages: ['testing'],
+ contextMenuColumn: true
+});