bito-code-review[bot] commented on code in PR #39684:
URL: https://github.com/apache/superset/pull/39684#discussion_r4031373948
##########
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx:
##########
@@ -473,6 +473,38 @@ describe('plugin-chart-table', () => {
expect(cells[4]).toHaveTextContent('2.47k');
});
+ test('render columns dropdown when visibleColumnsStorageKey is
provided', async () => {
+ const props = transformProps(testData.advanced);
+ const persistTableOwnState = jest.fn();
+ render(
+ ProviderWrapper({
+ children: (
+ <TableChart
+ {...props}
+ visibleColumnsStorageKey="table_col_key"
+ persistTableOwnState={persistTableOwnState}
+ sticky={false}
Review Comment:
<!-- Bito Reply -->
The suggestion is appropriate because the current test setup does not
correctly trigger the component's internal dashboard path check, which prevents
the `visibleColumnsStorageKey` logic from executing. By setting a valid
dashboard pathname and asserting the behavior of `persistTableOwnState` or the
data mask, the test would more accurately reflect the component's real-world
usage. This approach ensures the test exercises the intended functionality
rather than relying on props that the component does not currently utilize.
**superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx**
```
// Set window location to satisfy dashboard path check in TableChart.tsx:875
Object.defineProperty(window, 'location', {
value: { pathname: '/superset/dashboard/123/' },
writable: true,
});
```
--
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]