diff --git a/web/src/lib/components/DiscoverResultCard.svelte b/web/src/lib/components/DiscoverResultCard.svelte index 345e316f..ce7dba3d 100644 --- a/web/src/lib/components/DiscoverResultCard.svelte +++ b/web/src/lib/components/DiscoverResultCard.svelte @@ -12,6 +12,7 @@ subtitle, imageUrl, state, + attribution, onRequest, }: { kind: DiscoverCardKind; @@ -19,6 +20,7 @@ subtitle?: string; imageUrl?: string; state: DiscoverCardState; + attribution?: string; onRequest?: () => void; } = $props(); @@ -55,6 +57,11 @@ {#if subtitle}
{subtitle}
{/if} + {#if attribution} +
+ {attribution} +
+ {/if}
{#if state === 'kept'} Kept diff --git a/web/src/lib/components/DiscoverResultCard.test.ts b/web/src/lib/components/DiscoverResultCard.test.ts index acffc80f..b97bc8f4 100644 --- a/web/src/lib/components/DiscoverResultCard.test.ts +++ b/web/src/lib/components/DiscoverResultCard.test.ts @@ -104,4 +104,25 @@ describe('DiscoverResultCard', () => { // Lucide renders an inline ; verify its presence as a proxy for "fallback rendered" expect(container.querySelector('svg')).toBeInTheDocument(); }); + + test('renders attribution line when prop is set', () => { + render(DiscoverResultCard, { + props: { + kind: 'artist', + title: 'Outsider', + state: 'requestable', + attribution: 'Because you liked Boards of Canada and played Aphex Twin.' + } + }); + expect(screen.getByTestId('attribution')).toHaveTextContent( + 'Because you liked Boards of Canada and played Aphex Twin.' + ); + }); + + test('omits attribution line when prop is absent', () => { + render(DiscoverResultCard, { + props: { kind: 'artist', title: 'Outsider', state: 'requestable' } + }); + expect(screen.queryByTestId('attribution')).not.toBeInTheDocument(); + }); });