bito-code-review[bot] commented on code in PR #40386:
URL: https://github.com/apache/superset/pull/40386#discussion_r3307528800


##########
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:
   <!-- Bito Reply -->
   The suggestion in the provided context is valid and should be applied. The 
test was updated to use the correct property names (`rowSubTotals` and 
`colSubTotals`) to ensure subtotal labels are rendered correctly. The 
`tableRenderer` prop is not required for this specific test, as the key change 
was enabling the subtotal flags and using multi-level dimensions to produce 
subtotal label cells. This aligns with the user's correction and ensures the 
test accurately verifies the rendering of subtotal labels.
   
   
**superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/tableRenders.test.tsx**
   ```
   function buildDefaultProps(overrides: Record<string, unknown> = {}) {
     return {
       aggregatorName: 'Count',
       vals: [] as string[],
       aggregatorsFactory,
       tableRenderer: 'Table With Subtotal',
       tableOptions: {},
       onContextMenu: jest.fn(),
       ...overrides,
     };
   }
   
   test('TableRenderer renders subvalue labels for row and column subtotals', 
() => {
     const props = buildDefaultProps({
       tableRenderer: 'Table With Subtotal',
       tableOptions: {
         rowSubTotals: true,
         colSubTotals: true,
       },
     });
     // Test implementation
   });
   ```



-- 
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