Skip to content

Commit 57ad605

Browse files
committed
CHARTS-81: Add tests.
1 parent d8d5cea commit 57ad605

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

projects/js-packages/charts/src/components/leaderboard-chart/test/leaderboard-chart.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ describe( 'LeaderboardChart', () => {
6161
expect( screen.getByText( '-8%' ) ).toBeInTheDocument();
6262
} );
6363

64+
it( 'shows custom label when provided', () => {
65+
render(
66+
<LeaderboardChart
67+
data={ mockData.map( entry => ( {
68+
...entry,
69+
label: <span className="large-text">{ entry.label }</span>,
70+
} ) ) }
71+
withComparison={ false }
72+
/>
73+
);
74+
75+
expect( screen.getByText( 'Direct' ) ).toHaveClass( 'large-text' );
76+
expect( screen.getByText( 'Social Media' ) ).toHaveClass( 'large-text' );
77+
} );
78+
6479
it( 'hides comparison data when withComparison is false', () => {
6580
render( <LeaderboardChart data={ mockData } withComparison={ false } /> );
6681

0 commit comments

Comments
 (0)