{t('roadtrip.stop.endIsLeave')}
} {hasTimeError && ( diff --git a/client/src/components/Roadtrip/RoadtripSidebar.test.tsx b/client/src/components/Roadtrip/RoadtripSidebar.test.tsx index dbb63d409..13a6c42c4 100644 --- a/client/src/components/Roadtrip/RoadtripSidebar.test.tsx +++ b/client/src/components/Roadtrip/RoadtripSidebar.test.tsx @@ -322,7 +322,10 @@ describe('RoadtripSidebar', () => { const add = within(chain).getByText('+') fireEvent.click(add) - expect(onEditStay).toHaveBeenCalledWith({ placeId: 20, name: 'Berlin', minutes: null, arrival: null }) + // The visit rides along with the place, so the dialog can reach its end time. + expect(onEditStay).toHaveBeenCalledWith({ + placeId: 20, name: 'Berlin', minutes: null, arrival: null, departure: null, leaveAt: null, missedBy: null, assignmentId: 2, dayId: 1, + }) }) it('FE-ROADTRIP-SIDEBAR-034: a pause reached late says so, the same as a numbered stop', () => { @@ -342,6 +345,53 @@ describe('RoadtripSidebar', () => { expect(screen.getByLabelText(/45/)).toBeInTheDocument() }) + it('FE-ROADTRIP-SIDEBAR-049: a stop left at a set time shows the stay that makes, and until when', () => { + // The stay the place carries is 30 min; the End at two is what the drive keeps to. + const onEditStay = vi.fn() + const stops = [ + stop({ assignmentId: 1, name: 'Hamburg' }), + stop({ assignmentId: 2, name: 'Lueneburg', dwellMinutes: 30, leaveAt: '14:00' }), + ] + const schedule = { + entries: [ + { arrival: '09:00', departure: '09:00', anchored: true, dayOffset: 0 }, + { arrival: '10:00', departure: '14:00', anchored: false, dayOffset: 0 }, + ], + warnings: [], + } + wrap({stop.name}
+ + {leave.minutes === null ? t('roadtrip.stay.until', { time: until }) : formatDurationShort(leave.minutes * 60)} + + {leave.missedBy !== null ? ( +
+
+ {t(leave.dayEndsFirst ? 'roadtrip.stay.dayEndsFirst' : 'roadtrip.stay.leavesAt', { time: until })} +
+ )} + {/* The day ending first means the row's departure is only where it stops for the + night, not a time it leaves. */} + {arrive && !leave.dayEndsFirst ?