mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
test(map): opening another trip with the overview on frames that trip
The overview holds its camera frame across content edits and only publishes a fresh one on activation or on a trip switch. Activation is covered; the trip switch branch was not, so a regression there would leave the map framed on the previous trip. The new case keeps days and stops identical and changes only the trip id, so the switch alone has to produce the new frame.
This commit is contained in:
@@ -255,4 +255,22 @@ describe('useTripRouteOverview', () => {
|
||||
await waitFor(() => expect(result.current.loading).toBe(false))
|
||||
expect(result.current.focusPoints).not.toBe(frame)
|
||||
})
|
||||
|
||||
it('FE-MAP-TRO-014: opening another trip with the overview on publishes a fresh frame', async () => {
|
||||
// Same days and stops on purpose: only the trip changed, so nothing but the trip
|
||||
// switch itself can be what asks the map to frame again.
|
||||
const { result, rerender } = renderHook(
|
||||
({ tripId }: { tripId: number }) =>
|
||||
useTripRouteOverview(tripId, DAYS, ASSIGNMENTS, [], [], 'driving', true),
|
||||
{ initialProps: { tripId: 7 } },
|
||||
)
|
||||
await waitFor(() => expect(result.current.loading).toBe(false))
|
||||
const frame = result.current.focusPoints
|
||||
|
||||
rerender({ tripId: 8 })
|
||||
|
||||
await waitFor(() => expect(result.current.focusPoints).not.toBe(frame))
|
||||
await waitFor(() => expect(result.current.loading).toBe(false))
|
||||
expect(result.current.focusPoints).toEqual(frame)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user