diff --git a/frontend/src/lib/components/CommentMessage.svelte b/frontend/src/lib/components/CommentMessage.svelte index f1171448..f66c508c 100644 --- a/frontend/src/lib/components/CommentMessage.svelte +++ b/frontend/src/lib/components/CommentMessage.svelte @@ -32,7 +32,12 @@ const wasEdited = $derived(message.updatedAt > message.createdAt); const parsed = $derived(extractQuote(message.content)); -
+
{ await expect.element(textarea).toBeInTheDocument(); await expect.element(textarea).toHaveValue('current edit text'); }); + + it('exposes id="comment-{message.id}" on the article wrapper for deep-link scroll', async () => { + render(CommentMessage, defaultProps()); + const article = page.getByRole('article').element(); + expect(article.getAttribute('id')).toBe('comment-msg-1'); + }); + + it('is focusable but not in tab order (tabindex="-1")', async () => { + render(CommentMessage, defaultProps()); + const article = page.getByRole('article').element(); + expect(article.getAttribute('tabindex')).toBe('-1'); + }); + + it('shows a focus-visible ring when focused via keyboard', async () => { + render(CommentMessage, defaultProps()); + const article = page.getByRole('article').element(); + const classes = article.className; + expect(classes).toMatch(/focus-visible:ring-2/); + expect(classes).toMatch(/focus-visible:ring-brand-navy/); + expect(classes).toMatch(/outline-none/); + }); });