Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit c61b33d

Browse files
committed
Add test for showPercent
1 parent b265352 commit c61b33d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/polaris-viz/src/components/FunnelChartNext/components/FunnelChartLabels/tests/FunnelChartLabels.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('<FunnelChartLabels />', () => {
3030
percentages: ['100%', '75%', '50%'],
3131
xScale: scaleBand().domain(['0', '1', '2']).range([0, 300]),
3232
shouldApplyScaling: false,
33+
showPercentages: true,
3334
renderScaleIconTooltipContent: () => <div>Tooltip content</div>,
3435
trends: [
3536
{
@@ -108,6 +109,23 @@ describe('<FunnelChartLabels />', () => {
108109
text: '100%',
109110
});
110111
});
112+
113+
it('hides percentages when showPercentages is false', () => {
114+
const component = wrapper({
115+
...mockProps,
116+
showPercentages: false,
117+
});
118+
119+
expect(component).toContainReactComponent(SingleTextLine, {
120+
text: 'Step 1',
121+
});
122+
expect(component).not.toContainReactComponent(SingleTextLine, {
123+
text: '100%',
124+
});
125+
expect(component).toContainReactComponent(SingleTextLine, {
126+
text: '1,000',
127+
});
128+
});
111129
});
112130

113131
describe('trend indicators', () => {

0 commit comments

Comments
 (0)