diff --git a/web/src/lib/components/StatusPill.svelte b/web/src/lib/components/StatusPill.svelte new file mode 100644 index 00000000..cc6907b8 --- /dev/null +++ b/web/src/lib/components/StatusPill.svelte @@ -0,0 +1,54 @@ + + + + +{entry.label} + + diff --git a/web/src/lib/components/StatusPill.test.ts b/web/src/lib/components/StatusPill.test.ts new file mode 100644 index 00000000..6d8d1e08 --- /dev/null +++ b/web/src/lib/components/StatusPill.test.ts @@ -0,0 +1,25 @@ +import { describe, expect, test } from 'vitest'; +import { render, screen } from '@testing-library/svelte'; +import StatusPill from './StatusPill.svelte'; + +// Voice-rule labels and semantic tones per spec §6 / project_design_system.md. +// Each row is the contract: input status -> rendered label + data-tone attr. +const CASES = [ + { status: 'pending', label: 'Awaiting review', tone: 'warning' }, + { status: 'approved', label: 'Approved · downloading', tone: 'info' }, + { status: 'completed', label: 'Kept', tone: 'success' }, + { status: 'rejected', label: 'Set aside', tone: 'error' }, + { status: 'failed', label: "Couldn't add", tone: 'error' }, +] as const; + +describe('StatusPill', () => { + for (const { status, label, tone } of CASES) { + test(`${status} renders "${label}" with tone=${tone}`, () => { + render(StatusPill, { props: { status } }); + const pill = screen.getByText(label); + expect(pill).toBeInTheDocument(); + expect(pill.getAttribute('data-tone')).toBe(tone); + expect(pill.getAttribute('data-status')).toBe(status); + }); + } +});