diff --git a/client/src/components/Planner/DayPlanSidebar.test.tsx b/client/src/components/Planner/DayPlanSidebar.test.tsx
index 07125d9e..fb0d1187 100644
--- a/client/src/components/Planner/DayPlanSidebar.test.tsx
+++ b/client/src/components/Planner/DayPlanSidebar.test.tsx
@@ -187,7 +187,7 @@ describe('DayPlanSidebar', () => {
const assignments = { '10': [assignment] }
render()
// The chevron button immediately follows the "Add Note" button (which has a title attribute)
- const addNoteBtn = screen.getByTitle('Add Note')
+ const addNoteBtn = screen.getByLabelText('Add Note')
const chevron = addNoteBtn.nextElementSibling as HTMLButtonElement
expect(chevron).toBeTruthy()
await user.click(chevron)
@@ -201,7 +201,7 @@ describe('DayPlanSidebar', () => {
const assignment = buildAssignment({ id: 99, day_id: 10, order_index: 0, place })
const assignments = { '10': [assignment] }
render()
- const getChevron = () => screen.getByTitle('Add Note').nextElementSibling as HTMLButtonElement
+ const getChevron = () => screen.getByLabelText('Add Note').nextElementSibling as HTMLButtonElement
await user.click(getChevron()) // collapse
expect(screen.queryByText('Eiffel Tower')).not.toBeInTheDocument()
await user.click(getChevron()) // re-expand
@@ -362,28 +362,14 @@ describe('DayPlanSidebar', () => {
const user = userEvent.setup()
const onUndo = vi.fn()
render()
- // Find the undo button — it has width 30, height 30 and is not disabled
- const buttons = screen.getAllByRole('button')
- // The undo button is the one with the Undo2 icon and is not disabled
- const undoBtn = buttons.find(btn => {
- const style = btn.getAttribute('style') || ''
- return style.includes('width: 30px') || style.includes('width:30px') || (style.includes('30') && !btn.disabled)
- })
- if (undoBtn) {
- await user.click(undoBtn)
- expect(onUndo).toHaveBeenCalled()
- }
+ const undoBtn = screen.getByLabelText('Undo')
+ await user.click(undoBtn)
+ expect(onUndo).toHaveBeenCalled()
})
it('FE-PLANNER-DAYPLAN-024: undo button not present when onUndo not provided', () => {
render()
- // When onUndo is not provided, the undo section is not rendered at all
- const buttons = screen.getAllByRole('button')
- const undoBtn = buttons.find(btn => {
- const style = btn.getAttribute('style') || ''
- return style.includes('width: 30px')
- })
- expect(undoBtn).toBeUndefined()
+ expect(screen.queryByLabelText('Undo')).toBeNull()
})
// ── PDF export ──────────────────────────────────────────────────────────
@@ -931,7 +917,7 @@ describe('DayPlanSidebar', () => {
const user = userEvent.setup()
const day = buildDay({ id: 10, date: '2025-06-01', title: 'Day 1' })
render()
- const addNoteBtn = screen.getByTitle('Add Note')
+ const addNoteBtn = screen.getByLabelText('Add Note')
await user.click(addNoteBtn)
expect(mockDayNotesState.openAddNote).toHaveBeenCalled()
})
diff --git a/client/src/components/Planner/DayPlanSidebar.tsx b/client/src/components/Planner/DayPlanSidebar.tsx
index a9c99e40..7a100c09 100644
--- a/client/src/components/Planner/DayPlanSidebar.tsx
+++ b/client/src/components/Planner/DayPlanSidebar.tsx
@@ -1074,6 +1074,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar({