Berichten: hele rij klikbaar om het bericht te openen (CMS-U12)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 13:42:30 +01:00
co-authored by Claude Sonnet 5.5
parent daccc6a227
commit 21bdddc10d
2 changed files with 14 additions and 2 deletions
@@ -52,13 +52,15 @@ export function MessagesTable({ items, onOpen }: Props) {
<tr
key={m.id}
data-testid={`contact-row-${m.id}`}
className={
// The whole row opens the message; the name stays a real button for keyboard and screen readers.
onClick={() => onOpen(m.id)}
className={`cursor-pointer hover:bg-muted/50 ${
m.status === 'spam'
? 'bg-destructive/5'
: m.status === 'new'
? 'font-semibold'
: ''
}
}`}
>
<td className="p-2 whitespace-nowrap">
{format.format(new Date(m.receivedAt))}
@@ -696,3 +696,13 @@ describe('Dashboard tile', () => {
expect(screen.queryByTestId('messages-tile')).not.toBeInTheDocument();
});
});
describe('Clickable row', () => {
it('opens the message when any cell of the row is clicked', async () => {
await openPage();
const row = await screen.findByTestId(`contact-row-${MSG_READ}`);
await userEvent.click(within(row).getByText('Onderhoudspakket'));
expect(await screen.findByTestId('contact-message-dialog')).toBeInTheDocument();
expect(await screen.findByTestId('contact-message-body')).toHaveTextContent('Hallo');
});
});