Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(test): query form by tag since Save button is now in Modal footer

Maurice534149ba22f8
diff --git a/client/src/components/Planner/ReservationModal.test.tsx b/client/src/components/Planner/ReservationModal.test.tsx
index 7710a1887..4cf9c2089 100644
--- a/client/src/components/Planner/ReservationModal.test.tsx
+++ b/client/src/components/Planner/ReservationModal.test.tsx
@@ -203,8 +203,10 @@ describe('ReservationModal', () => {
fireEvent.change(datePickers[1], { target: { value: '2025-06-09' } });
fireEvent.change(timePickers[1], { target: { value: '09:00' } });
- // When isEndBeforeStart=true the submit button is disabled, so submit the form directly
- const form = screen.getByRole('button', { name: /^Add$/i }).closest('form')!;
+ // When isEndBeforeStart=true the submit button is disabled, so fire submit on the form directly.
+ // The Save button now lives in the Modal's sticky footer (outside the <form>), so we query
+ // the form by tag instead of walking up from the button.
+ const form = document.querySelector('form')!;
fireEvent.submit(form);
expect(onSave).not.toHaveBeenCalled();