mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 18:54:17 +00:00
feat(places): say when a place has an address but no coordinates (#2837)
A place saved with a typed address and no search pick, link or map point gets no coordinates, so it never shows on the map, and nothing said why. The place form warns under the address while that is so, and the inspector, the phone's place sheet and both place lists mark such a place. No geocoding on save; the form stays unchanged for a service stop, which explains a missing position itself.
This commit is contained in:
@@ -11,7 +11,7 @@ import { server } from '../../../helpers/msw/server'
|
||||
import { resetAllStores, seedStore } from '../../../helpers/store'
|
||||
import { fireEvent, render, screen, waitFor } from '../../../helpers/render'
|
||||
|
||||
// FE-MOB-PLEDIT-001 to FE-MOB-PLEDIT-048, plus the 009b, 025b and 029b variants
|
||||
// FE-MOB-PLEDIT-001 to FE-MOB-PLEDIT-049, plus the 009b, 025b and 029b variants
|
||||
// planner.t echoes the key, so every label/placeholder is asserted as its key.
|
||||
|
||||
const CATEGORIES = [
|
||||
@@ -718,4 +718,16 @@ describe('MPlaceEditSheet', () => {
|
||||
expect(planner.handleSavePlace).toHaveBeenCalledWith(expect.objectContaining({ name: 'Trailhead', osm_id: 'plugin:trail-finder:th-043' }))
|
||||
expect(planner.handleSavePlace).not.toHaveBeenCalledWith(expect.objectContaining({ google_place_id: expect.anything() }))
|
||||
})
|
||||
|
||||
it('FE-MOB-PLEDIT-049: a typed address without coordinates warns that the place will not be on the map (#2837)', () => {
|
||||
setup()
|
||||
expect(screen.queryByText('places.noCoordinatesFormHint')).not.toBeInTheDocument()
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText('places.formAddressPlaceholder'), { target: { value: '1-36-3 Asakusa' } })
|
||||
expect(screen.getByText('places.noCoordinatesFormHint')).toBeInTheDocument()
|
||||
|
||||
fireEvent.change(screen.getByPlaceholderText('places.formLat'), { target: { value: '35.71' } })
|
||||
fireEvent.change(screen.getByPlaceholderText('places.formLng'), { target: { value: '139.79' } })
|
||||
expect(screen.queryByText('places.noCoordinatesFormHint')).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -13,7 +13,7 @@ import type { Assignment, Category, Day, Place, TripFile, TripMember } from '../
|
||||
import { resetAllStores, seedStore } from '../../../helpers/store'
|
||||
import { act, fireEvent, render, screen, waitFor } from '../../../helpers/render'
|
||||
|
||||
// FE-MOB-PLSH-001 to FE-MOB-PLSH-032
|
||||
// FE-MOB-PLSH-001 to FE-MOB-PLSH-033
|
||||
|
||||
vi.mock('../../../../src/utils/fileDownload', () => ({ openFile: vi.fn() }))
|
||||
// The gallery says "no pictures" through the shared toast, the sheet's own writes through planner.toast.
|
||||
@@ -561,4 +561,14 @@ describe('MPlaceSheet', () => {
|
||||
|
||||
expect(screen.queryByText('Someone elses ferry')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-MOB-PLSH-033: a typed address without coordinates says the place is not on the map (#2837)', () => {
|
||||
const typed = { ...PLACE, lat: null, lng: null } as unknown as Place
|
||||
const { unmount } = renderSheet(makePlanner({ selectedPlace: typed }) as unknown as TripPlanner)
|
||||
expect(screen.getByText('No coordinates, so not on the map')).toBeInTheDocument()
|
||||
unmount()
|
||||
|
||||
renderSheet()
|
||||
expect(screen.queryByText('No coordinates, so not on the map')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -11,7 +11,7 @@ import { resetAllStores, seedStore } from '../../../helpers/store'
|
||||
import type { MTripShellApi, TripPlanner } from '../../../../src/mobile/screens/trip/MTripShell'
|
||||
import type { AssignmentsMap, Category, Day, Place } from '../../../../src/types'
|
||||
|
||||
// FE-MOB-PBROW-001 to FE-MOB-PBROW-036
|
||||
// FE-MOB-PBROW-001 to FE-MOB-PBROW-037
|
||||
|
||||
const CATEGORIES = [
|
||||
{ id: 1, name: 'Sights', color: '#123456', icon: 'landmark' },
|
||||
@@ -514,4 +514,12 @@ describe('MPlacesBrowser', () => {
|
||||
expect(screen.getByText('places.selectionCount:2')).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'common.selectAll' })).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-MOB-PBROW-037: a typed address without coordinates is marked as not on the map (#2837)', () => {
|
||||
const TYPED = place({ id: 5, name: 'Typed Cafe', address: 'Rue de Rivoli 1', lat: null, lng: null } as Partial<Place>)
|
||||
renderBrowser(makePlanner({ places: [TYPED, LOUVRE], assignments: {} } as Partial<TripPlanner>))
|
||||
|
||||
expect(within(row('Typed Cafe')).getByRole('img', { name: 'places.noCoordinates' })).toBeInTheDocument()
|
||||
expect(within(row('Louvre')).queryByRole('img', { name: 'places.noCoordinates' })).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user