mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 23:46:35 +00:00
feat(dayplan): offer public transport on any connector leg (#1281 follow-up)
The per-segment travel-mode menu now carries a "Public transit" entry on every editable connector: stop-to-stop legs and the boundary hotel/booking bookends alike. Choosing it opens the existing transit search pre-filled with the leg's origin, destination and the stop's departure time, instead of drawing an OSRM road route. A connector only renders when both endpoints are located, so the option is inherently limited to legs that can actually be searched. A leg's coordinates are resolved back to named, timed points from the trip's places, accommodations and booking endpoints. TransitSearchPanel gains an initialTime prop so the departure time can be seeded.
This commit is contained in:
@@ -177,6 +177,20 @@ describe('TransitSearchPanel', () => {
|
||||
expect(transitApiMock.plan.mock.calls[0][0]).toMatchObject({ arriveBy: true, time: '2025-06-01T08:00:00.000Z' })
|
||||
})
|
||||
|
||||
it('FE-PLANNER-TRANSIT-008b: initialTime seeds the departure time', async () => {
|
||||
const user = userEvent.setup()
|
||||
transitApiMock.plan.mockResolvedValueOnce({ itineraries: [] })
|
||||
render(<TransitSearchPanel {...makeProps({
|
||||
initialFrom: { name: 'Fernsehturm', lat: 52.5208, lng: 13.4094 },
|
||||
initialTo: { name: 'London Victoria', lat: 51.5074, lng: -0.1278 },
|
||||
initialTime: '11:00',
|
||||
})} />)
|
||||
await user.click(screen.getByRole('button', { name: /^Search$/ }))
|
||||
await waitFor(() => expect(transitApiMock.plan).toHaveBeenCalled())
|
||||
// 11:00 in Berlin (UTC+2) anchors depart-by to the origin zone → 09:00Z.
|
||||
expect(transitApiMock.plan.mock.calls[0][0]).toMatchObject({ time: '2025-06-01T09:00:00.000Z' })
|
||||
})
|
||||
|
||||
it('FE-PLANNER-TRANSIT-009: arrive-by lists the latest-arriving itinerary first', async () => {
|
||||
const user = userEvent.setup()
|
||||
// MOTIS returns arrive-by results ascending, deadline-adjacent last (#1479).
|
||||
|
||||
Reference in New Issue
Block a user