bito-code-review[bot] commented on code in PR #44907:
URL: https://github.com/apache/superset/pull/44907#discussion_r4171014629
##########
superset-frontend/plugins/plugin-chart-ag-grid-table/test/cellSelectionWiring.test.tsx:
##########
@@ -76,6 +76,44 @@ test('interactive table selects the cell on click (text
selection disabled) and
expect(typeof captured.props?.onCellKeyDown).toBe('function');
});
+test('a JSON control click and the second click of a double-click skip
cross-filtering', async () => {
+ const setDataMask = jest.fn();
+ const renderWithMask = () => {
+ captured.props = undefined;
+ render(
+ ProviderWrapper({
+ children: (
+ <AgGridTableChart
+ {...transformProps(testData.basic)}
+ setDataMask={setDataMask}
+ slice_id={1}
+ />
+ ),
+ }),
+ );
+ };
+ renderWithMask();
+ await waitFor(() => expect(captured.props?.onCellClicked).toBeDefined());
+
+ const onCellClicked = captured.props?.onCellClicked as (event: {
+ event?: { target?: EventTarget | null; detail?: number } | null;
+ }) => void;
+
+ const action = document.createElement('button');
+ action.setAttribute('data-json-cell-action', 'true');
+ onCellClicked({ event: { target: action } });
+
+ const cell = document.createElement('div');
+ cell.setAttribute('data-json-cell', 'true');
+ const text = document.createElement('span');
+ cell.appendChild(text);
+ document.body.appendChild(cell);
+ onCellClicked({ event: { target: text, detail: 2 } });
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Vacuous test assertion</b></div>
<div id="fix">
The events passed to `onCellClicked` lack `column`, so `handleCellClicked`
returns early at `!event.column` (AgGridTableChart.tsx:410) before the
JSON-skip guards run. `expect(setDataMask).not.toHaveBeenCalled()` is therefore
trivially satisfied and would still pass if the JSON-skip logic were removed.
Add a stub `column` to make the test actually exercise the intended path.
</div>
</div>
<small><i>Code Review Run #bc483f</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]