mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
fix(journey): draw the dashed line between entries on fullscreen leaflet maps too
The Leaflet journey map only drew the dashed route between entries when fullScreen was off. Since the desktop sidebar and the mobile map plus carousel view both pass fullScreen, the line was missing on the public journey page (desktop and phone) and in the logged in views with the Leaflet provider, while the GL renderer always drew it. fullScreen now only enables wheel zoom, matching JourneyMapGL where it only sets the pitch. Refs #2606
This commit is contained in:
@@ -386,13 +386,17 @@ describe('JourneyMap', () => {
|
||||
expect(L.polyline).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('FE-COMP-JOURNEYMAP-022: fullScreen enables wheel zoom and drops the route polyline', () => {
|
||||
it('FE-COMP-JOURNEYMAP-022: fullScreen enables wheel zoom and still draws the dashed route polyline', () => {
|
||||
render(
|
||||
<JourneyMap checkins={[]} entries={entriesWithCoords} fullScreen />
|
||||
);
|
||||
expect(vi.mocked(L.map).mock.calls[0][1]).toMatchObject({ scrollWheelZoom: true });
|
||||
// The connecting route line is a sidebar-only decoration
|
||||
expect(L.polyline).not.toHaveBeenCalled();
|
||||
// The public sidebar and the mobile map+carousel view both pass fullScreen,
|
||||
// and the line joining the entries has to show there too (#2606)
|
||||
expect(L.polyline).toHaveBeenCalledWith(
|
||||
[[48.8566, 2.3522], [52.52, 13.405]],
|
||||
expect.objectContaining({ dashArray: '4 6' }),
|
||||
);
|
||||
});
|
||||
|
||||
it('FE-COMP-JOURNEYMAP-023: clicking a marker reports the entry id', () => {
|
||||
|
||||
@@ -330,8 +330,8 @@ function JourneyMap(
|
||||
coords.forEach(c => trackCoords.push(c))
|
||||
}
|
||||
|
||||
// route polyline — only in non-fullscreen (sidebar map) mode
|
||||
if (!fullScreen && items.length > 1) {
|
||||
// route trail: dashed line connecting entries in time order, same as JourneyMapGL
|
||||
if (items.length > 1) {
|
||||
const routeCoords = items.map(i => [i.lat, i.lng] as L.LatLngTuple)
|
||||
L.polyline(routeCoords, {
|
||||
color: dark ? '#71717A' : '#A1A1AA',
|
||||
|
||||
@@ -277,6 +277,16 @@ describe('JourneyMapGL', () => {
|
||||
expect(gl.map.addLayer).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('FE-COMP-JMAPGL-037: the fullScreen map draws the route once the entries arrive after mount', () => {
|
||||
withToken()
|
||||
const { rerender } = render(<JourneyMapGL checkins={[]} entries={[]} fullScreen />)
|
||||
expect(gl.map.addSource).not.toHaveBeenCalledWith('journey-route', expect.anything())
|
||||
|
||||
rerender(<JourneyMapGL checkins={[]} entries={entries} fullScreen />)
|
||||
expect(gl.map.addSource).toHaveBeenCalledWith('journey-route', expect.objectContaining({ type: 'geojson' }))
|
||||
expect(gl.map.addLayer).toHaveBeenCalledWith(expect.objectContaining({ id: 'journey-route-line' }))
|
||||
})
|
||||
|
||||
it('FE-COMP-JMAPGL-010: the camera fits entries and trail with the requested bottom padding', () => {
|
||||
withToken()
|
||||
render(
|
||||
|
||||
Reference in New Issue
Block a user