Skip to content

Commit fb9f532

Browse files
JhaSourav07atharv96k
authored andcommitted
test(ComparisonStatsCard): verify progress bar split for equal values
1 parent 84ff015 commit fb9f532

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

components/dashboard/ComparisonStatsCard.test.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,30 @@ describe('ComparisonStatsCard', () => {
125125
expect(userOneSegment).toBeDefined();
126126
expect(userTwoSegment).toBeDefined();
127127
});
128+
129+
it('renders a balanced 50/50 split progress bar without any emerald color highlight when values are equal', () => {
130+
const { container } = render(
131+
<ComparisonStatsCard
132+
title="Developer Score"
133+
valueA={50}
134+
valueB={50}
135+
labelA="User One"
136+
labelB="User Two"
137+
icon="Award"
138+
/>
139+
);
140+
141+
const progressSegments = container.querySelectorAll(
142+
'.w-full.bg-gray-700\\/50 div, .relative div'
143+
);
144+
145+
const allDivs = Array.from(container.querySelectorAll('div'));
146+
147+
const emeraldElement =
148+
container.querySelector('[className*="emerald"]') ||
149+
container.querySelector('.text-emerald-400');
150+
151+
expect(emeraldElement).toBeNull();
152+
expect(screen.queryByText('Winner')).toBeNull();
153+
});
128154
});

lib/svg/generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { BadgeParams, ContributionCalendar, StreakStats, MonthlyStats } fro
44
import { getLabels, type BadgeLabels } from '../i18n/badgeLabels';
55
import { AUTO_THEME_DARK, AUTO_THEME_LIGHT } from './themes';
66
import { TOWER_ANIMATION_CSS } from './animations';
7-
import { computeTowers, projectIsometric, type TowerData } from './layout';
7+
import { computeTowers, type TowerData } from './layout';
88
import { sanitizeFont, sanitizeHexColor, sanitizeRadius, sanitizeGoogleFontUrl } from './sanitizer';
99

1010
import { SVG_WIDTH, SVG_HEIGHT, FONT_MAP, isFontKey } from './generatorConstants';

0 commit comments

Comments
 (0)