sadpandajoe commented on code in PR #35456:
URL: https://github.com/apache/superset/pull/35456#discussion_r2399694751


##########
superset-frontend/src/components/Datasource/components/DatasourceEditor/components/DatasetUsageTab/DatasetUsageTab.test.tsx:
##########
@@ -25,6 +26,59 @@ import {
 import fetchMock from 'fetch-mock';
 import DatasetUsageTab from '.';
 
+jest.mock('@superset-ui/core/components/Table', () => {
+  const React = require('react');
+  const actual = jest.requireActual('@superset-ui/core/components/Table');
+  const ActualTable = actual.default;
+
+  let latestPaginationHandler: ((page: number, pageSize?: number) => void) | 
null = null;
+  let latestPaginationPageSize: number | undefined;
+  let latestOnChangeHandler:
+    | ((pagination: { current: number; pageSize?: number }) => void)
+    | null = null;
+
+  const MockTable = ({ pagination, onChange, ...rest }: any) => {
+    if (pagination?.pageSize) {
+      latestPaginationPageSize = pagination.pageSize;
+    }
+
+    if (typeof pagination?.onChange === 'function') {
+      latestPaginationHandler = pagination.onChange;
+    }

Review Comment:
   We need both pagination.onChange (for pagination clicks) AND the top-level 
onChange (for table changes). The tests verify pagination behavior, so 
capturing pagination.onChange is necessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to