feat(planner): edit the trip from its settings in the planner (#2811)

The trip form was mounted in the planner but nothing opened it, so title, dates,
cover and currency could only be changed from My Trips. Trip settings now lists
Edit Trip at the foot of its areas for anyone with trip_edit; it swaps the dialog
for the trip form. The phone already has Edit Trip in the More sheet.
This commit is contained in:
Maurice
2026-11-13 09:24:06 +01:00
parent 66d85729ff
commit 64b86c2403
40 changed files with 123 additions and 22 deletions
@@ -1,6 +1,6 @@
// FE-COMP-MEMBERS-001 to FE-COMP-MEMBERS-061
// FE-COMP-MEMBERS-001 to FE-COMP-MEMBERS-063
import type { Mock } from 'vitest';
import { act, render, screen, fireEvent, waitFor } from '../../../tests/helpers/render';
import { act, render, screen, fireEvent, waitFor, within } from '../../../tests/helpers/render';
import userEvent from '@testing-library/user-event';
import { delay, http, HttpResponse } from 'msw';
import { server } from '../../../tests/helpers/msw/server';
@@ -1107,4 +1107,24 @@ describe('TripMembersModal', () => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('/join/inv9'));
view.unmount();
});
it('FE-COMP-MEMBERS-062: Edit Trip in the side column hands over to the trip form (#2811)', async () => {
const user = userEvent.setup();
const onEditTrip = vi.fn();
render(<TripMembersModal {...defaultProps} onEditTrip={onEditTrip} />);
// The column stands for it even where People is the only area.
const nav = await screen.findByRole('navigation', { name: 'Trip settings' });
await user.click(within(nav).getByRole('button', { name: 'Edit Trip' }));
expect(onEditTrip).toHaveBeenCalledTimes(1);
expect(within(nav).getByText('Title, dates, cover, description and currency.')).toBeInTheDocument();
});
it('FE-COMP-MEMBERS-063: without the right to edit the trip, the dialog offers no way to its form', async () => {
render(<TripMembersModal {...defaultProps} />);
expect(await screen.findByText('owner')).toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'Edit Trip' })).toBeNull();
});
});