mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 01:28:55 +00:00
fix(planner): a refresh of the trip no longer wipes an open transport or booking form
The transport form re-seeded itself whenever the trip's costs arrived as a new array, and the booking form whenever days, places or stays did. A socket reconnect re-reads the whole trip, so behind a proxy that drops idle sockets every 15 to 30 seconds everything typed so far was wiped. Both forms now re-seed only for what opens a different form; the data is read when the form is seeded, as before. Fixes #3069
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// FE-PLANNER-RESMODAL-001 to FE-PLANNER-RESMODAL-109
|
||||
// FE-PLANNER-RESMODAL-001 to FE-PLANNER-RESMODAL-110
|
||||
import { render, screen, waitFor, fireEvent, within, act } from '../../../tests/helpers/render';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
@@ -1829,4 +1829,13 @@ describe('ReservationModal', () => {
|
||||
expect(onSave.mock.calls[0][0].confirmation_number).toBe('PNR-NEW');
|
||||
});
|
||||
});
|
||||
|
||||
it('FE-PLANNER-RESMODAL-110: a refresh of the trip while the dialog is open keeps what the user typed (#3069)', async () => {
|
||||
const { rerender } = render(<ReservationModal {...defaultProps} />);
|
||||
const title = screen.getByPlaceholderText(/e\.g\. Lufthansa/i) as HTMLInputElement;
|
||||
await userEvent.type(title, 'Le Jules Verne');
|
||||
// A socket reconnect re-reads the trip: days, places and stays arrive as new arrays.
|
||||
rerender(<ReservationModal {...defaultProps} days={[]} places={[]} accommodations={[]} />);
|
||||
expect(title).toHaveValue('Le Jules Verne');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user