From 2520735850946112ba083fb7257c68ba5ba88e08 Mon Sep 17 00:00:00 2001 From: Josh Wright Date: Tue, 6 Oct 2026 19:51:09 -0400 Subject: [PATCH] Restore leaderboard combat and total rounds columns --- src/routes/leaderboard/+page.svelte | 2 +- tests/unit/ui-leaderboard.test.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/routes/leaderboard/+page.svelte b/src/routes/leaderboard/+page.svelte index 94633b0..0a454fe 100644 --- a/src/routes/leaderboard/+page.svelte +++ b/src/routes/leaderboard/+page.svelte @@ -18,7 +18,7 @@ const number = new Intl.NumberFormat('en-US'); const pageSize = leaderboardPageSize; const games = [{ key: 't5', label: 'Black Ops I' }, { key: 't6', label: 'Black Ops II' }]; - const defaultColumns: PlayerStatMetric[] = ['kills', 'gamesPlayed']; + const defaultColumns: PlayerStatMetric[] = ['kills', 'roundsSurvived', 'headshots', 'revives', 'downs', 'gamesPlayed']; const descriptions: Record = { highestRound: 'The highest round reached in a recorded game.', kills: 'Cumulative kills across recorded games.', diff --git a/tests/unit/ui-leaderboard.test.ts b/tests/unit/ui-leaderboard.test.ts index a3d3ad9..b586951 100644 --- a/tests/unit/ui-leaderboard.test.ts +++ b/tests/unit/ui-leaderboard.test.ts @@ -19,12 +19,12 @@ function scope(search = '') { function html(data = report()) { return render(Leaderboard, { props: { data: { leaderboard: data, user: null, setupRequired: false } } }).body; } beforeEach(() => scope()); -it('shows prominent totals and five columns, preserving ranks and collapsed identity and evidence', () => { +it('shows prominent totals and restored stat columns, preserving ranks and collapsed identity and evidence', () => { const body = html(); const headers = body.slice(body.indexOf('')); - expect(headers.match(/scope="col"/g)).toHaveLength(5); + expect(headers.match(/scope="col"/g)).toHaveLength(9); expect(headers).toContain('Highest round'); expect(headers).toContain('Total kills'); expect(headers).toContain('Games played'); - expect(headers).not.toContain('Headshots'); + for (const label of ['Total rounds', 'Headshots', 'Revives', 'Downs']) expect(headers).toContain(label); expect(body).toMatch(/]*>27<\/span>/); expect(body).toContain('26–26 of 60 players'); const overview = body.slice(body.indexOf('class="overview'), body.indexOf('class="rankings')); @@ -43,7 +43,7 @@ it('deduplicates the selected metric and preserves scope and pagination on playe const data = report(); data.metric = 'kills'; const body = html(data); const headers = body.slice(body.indexOf('')); - expect(headers.match(/scope="col"/g)).toHaveLength(4); + expect(headers.match(/scope="col"/g)).toHaveLength(8); expect(body).toContain('offset%3D25'); expect(body).toContain('q%3DCherry'); scope('?game=t5&map=t5%3Atheater&metric=highestRound&q=Cherry&offset=25'); const recordBody = html();