bito-code-review[bot] commented on code in PR #40386:
URL: https://github.com/apache/superset/pull/40386#discussion_r3295067478
##########
superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/tableRenders.test.tsx:
##########
@@ -159,6 +159,26 @@ test('TableRenderer renders grand total when both totals
are enabled', () => {
expect(grandTotalCells[0]).toHaveTextContent('4');
});
+test('TableRenderer renders subvalue labels for row and column subtotals', ()
=> {
+ const props = buildDefaultProps({
+ tableRenderer: 'Table With Subtotal',
+ tableOptions: {
+ rowSubtotalPosition: true,
+ colSubtotalPosition: true,
+ },
+ });
+ renderWithTheme(<TableRenderer {...props} />);
+
+ const subtotalLabels = Array.from(
+ document.querySelectorAll('.pvtSubtotalLabel'),
+ )
+ .map(cell => cell.textContent?.trim())
+ .filter(Boolean);
+
+ expect(subtotalLabels).toContain('Subvalue');
+ expect(subtotalLabels).not.toContain('Subtotal');
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Wrong property names prevent subtotals</b></div>
<div id="fix">
Test uses wrong property names that prevent subtotals from rendering.
`rowSubtotalPosition` and `colSubtotalPosition` are NOT in `TableOptions`
interface — the correct names are `rowSubTotals` and `colSubTotals` (lines 613,
620 use these). Additionally, `tableRenderer` prop is not in
`TableRendererProps` and is ignored. Without correct subtotal enablement,
`.pvtSubtotalLabel` elements will not exist and all assertions will fail.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
---
superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/tableRenders.test.tsx
---
+++
superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/tableRenders.test.tsx
@@ -60,6 +60,7 @@ function buildDefaultProps(overrides: Record<string,
unknown> = {}) {
aggregatorName: 'Count',
vals: [] as string[],
aggregatorsFactory,
+ tableRenderer: 'Table With Subtotal',
tableOptions: {},
onContextMenu: jest.fn(),
...overrides,
@@ -163,9 +164,8 @@ test('TableRenderer renders subvalue labels for row and
column subtotals', () => {
tableRenderer: 'Table With Subtotal',
tableOptions: {
- rowSubtotalPosition: true,
- colSubtotalPosition: true,
+ rowSubTotals: true,
+ colSubTotals: true,
},
});
```
</div>
</details>
</div>
<small><i>Code Review Run #0904d7</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]