mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
fix(roadtrip): the stage map shows its own night pause, and only that one
The moon pill marking where a travel day ends is back on the phone, filtered to the day on screen. The markers are built from the whole drive, which is right for the desktop rail and for the all-days view, but a stage draws one day: unfiltered, day 1 carried day 2's pill as well, sitting in the middle of a map that is otherwise entirely day 1. Two ends on a map that draws one is a question rather than a label. Off a stage the list is left alone, because in the all-days view every night does belong to a line that is drawn. The plan tab is unaffected either way: its vias come from the route calculation, which has no night pauses in it. This is what the map lost when the pills were dropped altogether: on a day whose drive ends somewhere other than its last stop, the pill is the only thing that says where.
This commit is contained in:
@@ -538,26 +538,27 @@ describe('MMapArea', () => {
|
||||
expect(mocks.props.focusPoints).toBe(shown)
|
||||
})
|
||||
|
||||
it('FE-MOB-MAPAREA-036: the phone map draws no night pause, on either tab', () => {
|
||||
// A night pause is the moon pill beside a day boundary. On the desktop it is a drag
|
||||
// handle with a hint; a phone has neither hover nor room to drag, and the markers come
|
||||
// from the whole drive rather than the stage, so day 1 showed day 2's pill too.
|
||||
const nightPause = { day: 2, atPlace: false }
|
||||
const vias = [
|
||||
{ lat: 53.55, lng: 9.99, tone: 'default' as const, nightPause },
|
||||
{ lat: 53.87, lng: 10.69, tone: 'default' as const, label: 'Rest stop' },
|
||||
]
|
||||
it('FE-MOB-MAPAREA-036: a stage keeps its own night pause and drops the other days', () => {
|
||||
// A night pause is the moon pill where a travel day ends. The markers are built from
|
||||
// the whole drive, so day 1 used to carry day 2's pill as well, in the middle of a map
|
||||
// that draws day 1 only. `stagePlanner(3)` is day 1 of the drive (stageDay).
|
||||
const own = { lat: 53.87, lng: 10.69, tone: 'default' as const, nightPause: { day: 1, atPlace: false } }
|
||||
const other = { lat: 53.55, lng: 9.99, tone: 'default' as const, nightPause: { day: 2, atPlace: false } }
|
||||
const plain = { lat: 53.6, lng: 10.2, tone: 'default' as const, label: 'Rest stop' }
|
||||
const vias = [own, other, plain]
|
||||
|
||||
const stage = renderArea(
|
||||
{ trTab: 'roadtrip', mapFront: true },
|
||||
{ ...stagePlanner(3), roadtripMapVias: vias } as unknown as Partial<TripPlanner>,
|
||||
)
|
||||
expect(mocks.props.routeVias).toEqual([vias[1]])
|
||||
// Its own night and everything that is not one; day 2's pill stays off this map.
|
||||
expect(mocks.props.routeVias).toEqual([own, plain])
|
||||
stage.unmount()
|
||||
|
||||
// The plan tab's own vias carry night pauses too, so they go through the same filter.
|
||||
// Off a stage the list is left alone: in the all-days view every night belongs to a
|
||||
// line that is actually drawn.
|
||||
renderArea({ trTab: 'plan' }, { routeVias: vias })
|
||||
expect(mocks.props.routeVias).toEqual([vias[1]])
|
||||
expect(mocks.props.routeVias).toBe(vias)
|
||||
})
|
||||
|
||||
it('FE-MOB-MAPAREA-026: the map layer carries no credit corner on either tab', () => {
|
||||
|
||||
Reference in New Issue
Block a user