rusackas commented on code in PR #40967:
URL: https://github.com/apache/superset/pull/40967#discussion_r3402419510


##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts:
##########
@@ -125,6 +125,35 @@ describe('transformSeries', () => {
     // OpacityEnum.NonTransparent = 1 (not dimmed)
     expect((result as any).itemStyle.opacity).toBe(1);
   });
+
+  test('should use symbolSizeFn for symbolSize when provided', () => {
+    const symbolSizeFn = jest.fn(
+      (value: (number | string | null)[]) => Number(value[1]) * 2,
+    );
+    const opts = {
+      seriesType: EchartsTimeseriesSeriesType.Scatter,
+      markerSize: 7,
+      symbolSizeFn,
+      timeShiftColor: false,
+    };
+
+    const result = transformSeries(series, mockColorScale, 'test-key', opts);
+
+    expect((result as any).symbolSize).toBe(symbolSizeFn);
+    expect((result as any).symbolSize(['A', 4])).toBe(8);

Review Comment:
   Fair point... swapped the `any` casts for `ScatterSeriesOption` so 
`symbolSize` is checked through the real type.



##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts:
##########
@@ -125,6 +125,35 @@ describe('transformSeries', () => {
     // OpacityEnum.NonTransparent = 1 (not dimmed)
     expect((result as any).itemStyle.opacity).toBe(1);
   });
+
+  test('should use symbolSizeFn for symbolSize when provided', () => {
+    const symbolSizeFn = jest.fn(
+      (value: (number | string | null)[]) => Number(value[1]) * 2,
+    );
+    const opts = {
+      seriesType: EchartsTimeseriesSeriesType.Scatter,
+      markerSize: 7,
+      symbolSizeFn,
+      timeShiftColor: false,
+    };
+
+    const result = transformSeries(series, mockColorScale, 'test-key', opts);
+
+    expect((result as any).symbolSize).toBe(symbolSizeFn);
+    expect((result as any).symbolSize(['A', 4])).toBe(8);
+  });
+
+  test('should fall back to markerSize for symbolSize when symbolSizeFn is not 
provided', () => {
+    const opts = {
+      seriesType: EchartsTimeseriesSeriesType.Scatter,
+      markerSize: 7,
+      timeShiftColor: false,
+    };
+
+    const result = transformSeries(series, mockColorScale, 'test-key', opts);
+
+    expect((result as any).symbolSize).toBe(7);

Review Comment:
   Done! This one now goes through `ScatterSeriesOption` too.



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