codeant-ai-for-open-source[bot] commented on code in PR #40967:
URL: https://github.com/apache/superset/pull/40967#discussion_r3400936778
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/controlPanel.test.ts:
##########
@@ -148,3 +148,59 @@ test('x_axis_number_format control should be hidden for
non-numeric data types',
expect(isNumberVisible(null, null)).toBe(false);
expect(isNumberVisible('time_column', GenericDataType.Temporal)).toBe(false);
});
+
+// tests for orientation and dot size controls
+const orientationControl: any = getControl('orientation');
+const sizeControl: any = getControl('size');
+const minMarkerSizeControl: any = getControl('minMarkerSize');
+const maxMarkerSizeControl: any = getControl('maxMarkerSize');
+
+test('scatter chart control panel should include an orientation control
defaulting to vertical', () => {
+ expect(orientationControl).toBeDefined();
+ expect(orientationControl.config.default).toBe('vertical');
+ expect(orientationControl.config.options).toEqual([
+ ['vertical', expect.anything()],
+ ['horizontal', expect.anything()],
+ ]);
+});
+
+test('scatter chart control panel should include an optional dot size metric
control', () => {
+ expect(sizeControl).toBeDefined();
+ expect(sizeControl.config.validators).toEqual([]);
+ expect(sizeControl.config.default).toBeNull();
+});
+
+const mockSizeControls = (
+ sizeValue: string | null,
+): ControlPanelsContainerProps =>
+ ({
+ controls: {
+ size: { value: sizeValue },
+ markerEnabled: { value: true },
+ },
+ }) as unknown as ControlPanelsContainerProps;
+
+test('dot size range controls should only be visible when a size metric is
set', () => {
+ expect(minMarkerSizeControl.config.visibility(mockSizeControls(null))).toBe(
+ false,
+ );
+ expect(maxMarkerSizeControl.config.visibility(mockSizeControls(null))).toBe(
+ false,
+ );
+ expect(
+ minMarkerSizeControl.config.visibility(mockSizeControls('size_metric')),
+ ).toBe(true);
+ expect(
+ maxMarkerSizeControl.config.visibility(mockSizeControls('size_metric')),
+ ).toBe(true);
+});
+
+test('fixed marker size control should hide when a size metric is set', () => {
+ const markerSizeControl: any = getControl('markerSize');
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> In this test file, use the typed `TestControl` for visibility assertions
instead of `any`.
**Applied to:**
-
`superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/controlPanel.test.ts`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
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]