bito-code-review[bot] commented on code in PR #40181:
URL: https://github.com/apache/superset/pull/40181#discussion_r3253113331
##########
superset-frontend/plugins/plugin-chart-echarts/test/Treemap/transformProps.test.ts:
##########
@@ -74,4 +74,42 @@ describe('Treemap transformProps', () => {
}),
);
});
+
+ test('should not render gaps between treemap nodes when filtered', () => {
+ const filteredChartProps = new ChartProps({
+ ...chartProps,
+ filterState: { selectedValues: ['Sylvester,bar1'] },
+ });
+
+ expect(
+ transformProps(filteredChartProps as EchartsTreemapChartProps),
+ ).toEqual(
+ expect.objectContaining({
+ echartOptions: expect.objectContaining({
+ series: [
+ expect.objectContaining({
+ data: expect.arrayContaining([
+ expect.objectContaining({
+ children: expect.arrayContaining([
+ expect.objectContaining({
+ name: 'Arnold',
+ children: expect.arrayContaining([
+ expect.objectContaining({
+ name: 'bar2',
+ itemStyle: expect.objectContaining({
+ borderWidth: 0,
+ gapWidth: 0,
+ }),
+ }),
+ ]),
+ }),
+ ]),
+ }),
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incomplete assertion for dimmed state</b></div>
<div id="fix">
Test at line 78-107 asserts on `borderWidth: 0` and `gapWidth: 0` for
Arnold/bar2, but these are identical for both dimmed and non-dimmed states
(both use BORDER_WIDTH=0 and GAP_WIDTH=0). Per `transformProps.ts:207-214`,
nodes NOT in `selectedValues` are dimmed via `colorAlpha:
OpacityEnum.SemiTransparent` (0.3) and `label: {...}`. The test does not verify
these distinguishing properties, so it only passes coincidentally because
default border/gap values happen to be 0.
</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-echarts/test/Treemap/transformProps.test.ts
(lines 78-113) ---
78: test('should not render gaps between treemap nodes when filtered', ()
=> {
79: const filteredChartProps = new ChartProps({
80: ...chartProps,
81: filterState: { selectedValues: ['Sylvester,bar1'] },
82: });
84: expect(
85: transformProps(filteredChartProps as EchartsTreemapChartProps),
86: ).toEqual(
87: expect.objectContaining({
88: echartOptions: expect.objectContaining({
89: series: [
90: expect.objectContaining({
91: data: expect.arrayContaining([
92: expect.objectContaining({
93: children: expect.arrayContaining([
94: expect.objectContaining({
95: name: 'Arnold',
96: children: expect.arrayContaining([
97: expect.objectContaining({
98: name: 'bar2',
99: itemStyle: expect.objectContaining({
100: borderWidth: 0,
101: gapWidth: 0,
102: colorAlpha: 0.3,
103: }),
104: label: expect.objectContaining({}),
105: }),
106: ]),
107: }),
108: ]),
109: }),
110: ]),
111: }),
112: ],
113: }),
114: ),
115: );
116: });
```
</div>
</details>
</div>
<small><i>Code Review Run #60bd9f</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]