Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 22f254c

Browse files
committedOct 15, 2024·
feat(charts): allow configuring the internal Legend component
1 parent 4d3f4fc commit 22f254c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+248
-24
lines changed
 

‎cypress/support/utils.tsx

+16
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,19 @@ export function testChartZoomingTool(Component, props) {
8484
cy.get('.recharts-brush [stroke="red"]').should('be.visible');
8585
});
8686
}
87+
88+
export function testChartLegendConfig(Component, props) {
89+
it('legendConfig', () => {
90+
cy.mount(
91+
<Component
92+
{...props}
93+
chartConfig={{
94+
legendConfig: {
95+
formatter: (value) => <span data-testid="catval">{value}🐱</span>
96+
}
97+
}}
98+
/>
99+
);
100+
cy.findAllByTestId('catval').should('be.visible');
101+
});
102+
}

‎packages/charts/src/components/BarChart/BarChart.cy.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { complexDataSet } from '../../resources/DemoProps.js';
22
import { BarChart } from './BarChart.js';
3-
import { cypressPassThroughTestsFactory, testChartZoomingTool } from '@/cypress/support/utils';
3+
import { cypressPassThroughTestsFactory, testChartLegendConfig, testChartZoomingTool } from '@/cypress/support/utils';
44

55
const dimensions = [
66
{
@@ -88,6 +88,8 @@ describe('BarChart', () => {
8888
cy.contains('Loading...').should('exist');
8989
});
9090

91+
testChartLegendConfig(BarChart, { dataset: complexDataSet, dimensions, measures });
92+
9193
testChartZoomingTool(BarChart, { dataset: complexDataSet, dimensions, measures });
9294

9395
cypressPassThroughTestsFactory(BarChart, { dimensions: [], measures: [] });

0 commit comments

Comments
 (0)
Please sign in to comment.