fix(mobile): a stay can be added to a trip that has no place yet

A stay belongs to one of the trip's places, so on a new trip the
accommodation sheet only said "Add places to your trip first", and the
booking could not be saved without leaving the sheet (TestFlight feedback,
5.1.3). The hint now carries the "Add place/activity" button for anyone
allowed to add places: the place form opens over the sheet, and the place
is listed to pick once it is saved.
This commit is contained in:
Maurice
2026-11-19 21:31:46 +01:00
parent 6e919696bb
commit 73a7c4843b
2 changed files with 42 additions and 5 deletions
@@ -8,7 +8,7 @@ import { useSettingsStore } from '../../../../src/store/settingsStore'
import { isBlurred } from '../../../helpers/bookingCodeBlur'
import { act, fireEvent, render, screen, waitFor } from '../../../helpers/render'
// FE-MOB-ACCSH-001 to FE-MOB-ACCSH-031
// FE-MOB-ACCSH-001 to FE-MOB-ACCSH-033
// The pickers have their own suites; here they only need to be addressable, so
// they render as plain controls. data-value keeps the requested value readable
@@ -256,6 +256,22 @@ describe('MAccommodationSheet', () => {
expect(screen.getByText('Add places to your trip first')).toBeInTheDocument()
})
it('FE-MOB-ACCSH-032: a trip without places offers to add one instead of a dead end', () => {
const { planner } = setup(makePlanner({ places: [] }))
expect(screen.getByText('Add places to your trip first')).toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Add place/activity' }))
expect(planner.setEditingPlace).toHaveBeenCalledWith(null)
expect(planner.setShowPlaceForm).toHaveBeenCalledWith(true)
})
it('FE-MOB-ACCSH-033: without the right to add places the hint stays a hint', () => {
setup(makePlanner({ places: [], can: vi.fn(() => false) }))
expect(screen.getByText('Add places to your trip first')).toBeInTheDocument()
expect(screen.queryByRole('button', { name: 'Add place/activity' })).toBeNull()
})
it('FE-MOB-ACCSH-018: without categories there are no filter chips', () => {
setup(makePlanner({ categories: [] }))
expect(screen.queryByRole('button', { name: 'Hotels' })).not.toBeInTheDocument()