diff --git a/client/src/components/Collab/CollabNotes.test.tsx b/client/src/components/Collab/CollabNotes.test.tsx index 3b5e57d84..4d707c296 100644 --- a/client/src/components/Collab/CollabNotes.test.tsx +++ b/client/src/components/Collab/CollabNotes.test.tsx @@ -498,8 +498,7 @@ describe('CollabNotes', () => { render(); await screen.findByText('Expandable Note'); // Expand button (Maximize2 icon) appears when note has content - // The translation key 'collab.notes.expand' falls back to the raw key since it's not in en.ts - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); // View modal shows the note title await waitFor(() => { const titles = screen.getAllByText('Expandable Note'); @@ -522,7 +521,7 @@ describe('CollabNotes', () => { ); render(); await screen.findByText('View Modal Note'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); // Modal is open — there are multiple instances of the title await waitFor(() => expect(screen.getAllByText('View Modal Note').length).toBeGreaterThan(1)); // The view modal renders a pencil button to switch to edit mode @@ -927,7 +926,7 @@ describe('CollabNotes', () => { ); render(); await screen.findByText('Full Content Note'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); // View modal shows the full content await waitFor(() => { const titles = screen.getAllByText('Full Content Note'); @@ -952,7 +951,7 @@ describe('CollabNotes', () => { ); render(); await screen.findByText('Tagged Note'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); // View modal header shows the category name await waitFor(() => { const foodEls = screen.getAllByText('Food'); @@ -1108,7 +1107,7 @@ describe('CollabNotes', () => { await screen.findByText('Attached View Note'); // PDF badge is present in NoteCard expect(screen.getByText('PDF')).toBeInTheDocument(); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); // View modal opens — title appears multiple times await waitFor(() => expect(screen.getAllByText('Attached View Note').length).toBeGreaterThan(1)); // PDF badge appears in both card and view modal @@ -1132,7 +1131,7 @@ describe('CollabNotes', () => { ); render(); await screen.findByText('Image View Note'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); // View modal opens await waitFor(() => expect(screen.getAllByText('Image View Note').length).toBeGreaterThan(1)); // The view modal code for image attachments executed (AuthedImg renders initially null, then img after async) @@ -1154,7 +1153,7 @@ describe('CollabNotes', () => { ); render(); await screen.findByText('Transition Note'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); await waitFor(() => expect(screen.getAllByText('Transition Note').length).toBeGreaterThan(1)); // Click the Pencil button in the view modal (second-to-last button) const allButtons = screen.getAllByRole('button'); @@ -1713,7 +1712,7 @@ describe('CollabNotes details', () => { serveNotes({ notes: [buildNote({ id: 5, title: 'Long note', content: 'Full body', category: 'Food', color: '#ef4444' })] }); render(); await screen.findByText('Long note'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); const modal = await waitFor(() => { const md = document.querySelector('.collab-note-md-full') if (!md) throw new Error('view modal not open yet') @@ -1751,7 +1750,7 @@ describe('CollabNotes details', () => { }); render(); await screen.findByText('Trip docs'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); const modal = await waitFor(() => { const md = document.querySelector('.collab-note-md-full') if (!md) throw new Error('view modal not open yet') @@ -1928,7 +1927,7 @@ describe('CollabNotes details', () => { serveNotes({ notes: [buildNote({ id: 7, title: 'Hotel', content: 'Zimmernummer bestaetigen' })] }); render(); await screen.findByText('Hotel'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); const full = await openedNoteBody(); // Notes written before markdown rendering existed keep reading the way they // were typed (#2177). @@ -1940,7 +1939,7 @@ describe('CollabNotes details', () => { serveNotes({ notes: [buildNote({ id: 8, title: 'Booking', content: 'Hotel gebucht[^1]\n\n[^1]: Bestaetigung ABC123' })] }); render(); await screen.findByText('Booking'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); const full = await openedNoteBody(); const ref = within(full).getByRole('link', { name: '1' }); @@ -1956,7 +1955,7 @@ describe('CollabNotes details', () => { server.use(http.get('/api/trips/1/collab/link-preview', () => HttpResponse.json({ title: 'Hotel', image: null }))); render(); await screen.findByText('Hotel'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); const full = await openedNoteBody(); // A member without collab_edit never opens the edit modal, so this is the @@ -1972,7 +1971,7 @@ describe('CollabNotes details', () => { serveNotes({ notes: [buildNote({ id: 10, title: 'Hotel', website: 'javascript:alert(1)' })] }); render(); await screen.findByText('Hotel'); - await user.click(screen.getByTitle('collab.notes.expand')); + await user.click(screen.getByRole('button', { name: 'Expand' })); const full = await openedNoteBody(); expect(within(full).queryAllByRole('link')).toHaveLength(0); diff --git a/client/src/components/Collab/CollabNotesCard.tsx b/client/src/components/Collab/CollabNotesCard.tsx index 4da68ee0e..95e474697 100644 --- a/client/src/components/Collab/CollabNotesCard.tsx +++ b/client/src/components/Collab/CollabNotesCard.tsx @@ -81,7 +81,7 @@ export function NoteCard({ note, currentUser, canEdit, onUpdate, onDelete, onEdi display: 'flex', gap: 2, }}> {note.content && ( -