From ca70cf7678d8418a73767f4466282a0c5f8d3681 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 23 Nov 2026 17:51:13 -0500 Subject: [PATCH] test(web): a wide card's wash is its cover colour as washTone tones it Co-Authored-By: Claude Opus 5.5 --- web/src/lib/components/PlaylistCard.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/src/lib/components/PlaylistCard.test.ts b/web/src/lib/components/PlaylistCard.test.ts index a23cdc63..dfeb3153 100644 --- a/web/src/lib/components/PlaylistCard.test.ts +++ b/web/src/lib/components/PlaylistCard.test.ts @@ -1,6 +1,7 @@ import { describe, expect, test, vi, beforeEach } from 'vitest'; import { render, screen, fireEvent, waitFor } from '@testing-library/svelte'; import PlaylistCard from './PlaylistCard.svelte'; +import { washTone } from '#lib/playlists/shelf.js'; import type { Playlist, PlaylistDetail } from '#lib/api/types.js'; vi.mock('#lib/auth/store.svelte.js', () => ({ @@ -364,10 +365,11 @@ describe('PlaylistCard', () => { expect(screen.getByText(/12\s+tracks/)).toBeInTheDocument(); }); - test('a wide card takes the colour of its lead cover', async () => { + test('a wide card takes the colour of its lead cover, toned for its text', async () => { const { container } = render(PlaylistCard, { props: { playlist: mix, shape: 'wide', covers: ['al-7'] } }); const card = container.querySelector('[data-shape="wide"] a') as HTMLElement; - await waitFor(() => expect(card.style.getPropertyValue('--wash')).toBe('rgb(90 40 130)')); + const { r, g, b } = washTone({ r: 90, g: 40, b: 130 }); + await waitFor(() => expect(card.style.getPropertyValue('--wash')).toBe(`rgb(${r} ${g} ${b})`)); }); test('the shelf heading can carry the refresh line instead of the tile', () => {