Aleem89 commented on code in PR #45505:
URL: https://github.com/apache/superset/pull/45505#discussion_r4329368010
##########
superset-frontend/packages/superset-ui-core/test/utils/tooltip.test.ts:
##########
@@ -272,3 +273,30 @@ describe('tooltipHtml truncation modes', () => {
});
});
});
+
+describe('tooltipMarker', () => {
+ test('keeps its color and shape through sanitizeHtml', () => {
+ const html = removeWhitespaces(
+ sanitizeHtml(tooltipMarker('#1f77b4', 'pin')),
+ );
+ expect(html).toContain('color:#1f77b4');
+ expect(html).toContain('border:5pxsolidcurrentcolor');
+ expect(html).toContain('border-radius:50%50%050%');
+ });
+
+ test('draws the triangle with borders and the diamond as a glyph', () => {
+ expect(tooltipMarker('#1f77b4', 'triangle')).toContain(
Review Comment:
Done in eccdb58. The triangle now goes through `sanitizeHtml` too, with
assertions on the border widths, the transparent `border-color` and the
`calc()` lift.
##########
superset-frontend/plugins/plugin-chart-echarts/src/Histogram/transformProps.ts:
##########
@@ -123,8 +124,11 @@ export default function transformProps(
const tooltipFormatter = (params: CallbackDataParams[]) => {
const title = params[0].name;
const rows = params.map(param => {
- const { marker, seriesName, value } = param;
- return [`${marker}${seriesName}`, yAxisFormatter.format(value as
number)];
+ const { color, seriesName, value } = param;
+ return [
+ `${tooltipMarker(color)}${seriesName}`,
Review Comment:
Added in eccdb58: a Histogram test that calls the tooltip formatter with a
coloured param and checks the colour reaches the output, same shape as the
Timeseries truncation tests.
--
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]