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:
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user