mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
feat(tours): complete planner follow-up scope
This commit completes the reviewed Tours follow-up scope after the Tours MVP was merged into dev. Included feature blocks: - RC-01: identify Tours in PLAN day rows and show compact Tour facts; - RC-06: search for a city or address in TOUR-PLANNER without hidden writes; - RC-07: reorder Tour waypoints in the left sidebar; - RC-08: drag Tour waypoints on Leaflet, MapLibre and Mapbox with stable viewport, history and routing behavior; - RS-01: persist Tour descriptions and HTTPS information links with local provider classification; - RS-02: persist breaks/additional time and calculated or manually adjusted planned Tour duration without changing scheduling semantics. The implementation preserves: - ordinary Place and Legacy Track behavior; - Tours-off fallback behavior; - existing GPX/import behavior; - Tour assignment and deletion behavior; - calculated routing duration as a separate value; - existing Tour provenance fields; - keyboard/list alternatives for waypoint editing. Not included: - PR1-09 trip-wide Tour summary; - Wanderer integration; - GPX import changes; - new Tour types; - Tour-to-Day drag-and-drop; - further roadmap or Post-Release features. Validation: - focused RC-01/RC-06/RC-07/RC-08/RS-01/RS-02 tests passed; - affected shared/server/client typechecks passed; - migration and generated DB type checks passed; - scoped ESLint passed; - staged diff checks passed; - owner manual tests passed for all six feature blocks.
This commit is contained in:
@@ -364,4 +364,43 @@ describe('LocationSelect', () => {
|
||||
expect(screen.queryByText('Gare du Nord')).not.toBeInTheDocument();
|
||||
expect(screen.getByText('Gare de Lyon')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('marks the keyboard-highlighted result as active and selects it with Enter', async () => {
|
||||
const user = userEvent.setup();
|
||||
server.use(searchRoute([GARE, LYON]));
|
||||
const onPick = vi.fn();
|
||||
|
||||
render(<LocationSelect value={null} onChange={onPick} ariaLabel="Search map location" showSearchStatus />);
|
||||
const input = screen.getByRole('combobox', { name: 'Search map location' });
|
||||
await user.type(input, 'Gare');
|
||||
const firstOption = await screen.findByRole('option', { name: /Gare du Nord/ });
|
||||
await user.keyboard('{ArrowDown}');
|
||||
|
||||
expect(firstOption).toHaveAttribute('aria-selected', 'true');
|
||||
expect(input).toHaveAttribute('aria-activedescendant', firstOption.id);
|
||||
await user.keyboard('{Enter}');
|
||||
expect(onPick).toHaveBeenCalledWith(expect.objectContaining({ name: 'Gare du Nord' }));
|
||||
});
|
||||
|
||||
it('shows a localized no-result status after an empty successful search', async () => {
|
||||
const user = userEvent.setup();
|
||||
server.use(searchRoute([]));
|
||||
|
||||
render(<LocationSelect value={null} onChange={vi.fn()} ariaLabel="Search map location" showSearchStatus />);
|
||||
await user.type(screen.getByRole('combobox', { name: 'Search map location' }), 'Nowhere');
|
||||
|
||||
expect(await screen.findByText(/Nothing found for/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows a non-mutating error status when the provider request fails', async () => {
|
||||
const user = userEvent.setup();
|
||||
server.use(http.post('/api/maps/search', () => HttpResponse.json({ error: 'unavailable' }, { status: 503 })));
|
||||
const onChange = vi.fn();
|
||||
|
||||
render(<LocationSelect value={null} onChange={onChange} ariaLabel="Search map location" showSearchStatus />);
|
||||
await user.type(screen.getByRole('combobox', { name: 'Search map location' }), 'Kyoto');
|
||||
|
||||
expect(await screen.findByRole('alert')).toHaveTextContent('Error');
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user