Copilot commented on code in PR #36197:
URL: https://github.com/apache/superset/pull/36197#discussion_r2547183561
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -723,3 +723,42 @@ describe('legend sorting', () => {
]);
});
});
+
+describe('x-axis label behavior', () => {
+ it('should set hideOverlap to false for time-based x-axis', () => {
+ const chartProps = new ChartProps(chartPropsConfig);
+ const transformed = transformProps(
+ chartProps as EchartsTimeseriesChartProps,
+ );
+
+ expect(transformed.echartOptions.xAxis).toEqual(
+ expect.objectContaining({
+ axisLabel: expect.objectContaining({
+ hideOverlap: false,
+ }),
+ }),
+ );
+ });
Review Comment:
The test claims to verify "time-based x-axis" behavior, but it doesn't
actually create a time-based axis. Without providing `coltypes` and `colnames`
in the `queriesData`, the `getColtypesMapping()` function returns an empty
object, causing `xAxisDataType` to be `undefined`. This results in
`getAxisType()` returning `AxisType.Category` (not `AxisType.Time`), so the
test is actually checking categorical axis behavior.
To properly test time-based axis behavior, add `coltypes` and `colnames` to
the query data:
```typescript
const timeBasedChartProps = new ChartProps({
...chartPropsConfig,
queriesData: [
{
...queriesData[0],
colnames: ['__timestamp', 'San Francisco', 'New York'],
coltypes: [GenericDataType.Temporal, GenericDataType.Numeric,
GenericDataType.Numeric],
},
],
});
```
You'll also need to import `GenericDataType` from `@superset-ui/core` or
`@apache-superset/core/api/core`.
--
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]