mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 09:38:54 +00:00
fix(planner): place edit and delete controls follow place_edit, not day_edit
With places set to "Trip owner" a member who may edit days still saw Edit and Delete on a place in the day plan's context menu, the inspector's action row, its inline rename and the phone timeline's edit circle, and every one of them ended in the server's 403. The day plan gates the two entries on place_edit (taking a place off the day stays a day right), the inspector drops its edit, delete and update handlers without the right the way the places pool already does, the phone timeline offers the pencil only with it, and openPlaceEditor and handleDeletePlace guard like their siblings. Closes #2446
This commit is contained in:
@@ -622,6 +622,19 @@ describe('MPlanTimeline', () => {
|
||||
expect(mocks.tl.removeAssignment).toHaveBeenCalledWith(MUSEUM)
|
||||
})
|
||||
|
||||
it('FE-MOB-PLTL-048: without place_edit a place row keeps remove and reorder but loses its edit circle (#2446)', () => {
|
||||
renderTimeline({}, { can: vi.fn((action: string) => action !== 'place_edit') as TripPlanner['can'] }, { mode: 'edit' })
|
||||
|
||||
// the place row keeps its remove circle and loses the edit one; the
|
||||
// transport and note rows keep theirs, editing those is a day right
|
||||
const row = screen.getByText('Museum').closest('[role="button"]') as HTMLElement
|
||||
expect(within(row).getByLabelText('planner.removeFromDay')).toBeInTheDocument()
|
||||
expect(within(row).queryByLabelText('common.edit')).not.toBeInTheDocument()
|
||||
fireEvent.click(within(row).getByLabelText('planner.removeFromDay'))
|
||||
expect(mocks.tl.removeAssignment).toHaveBeenCalledWith(MUSEUM)
|
||||
expect(mocks.tl.editAssignment).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('FE-MOB-PLTL-037: the transit row opens the journey view from its edit circle', () => {
|
||||
renderTimeline({}, {}, { mode: 'edit' })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user