mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 11:06:06 +00:00
fix(client): the trip form's review and the slow-open splash, and the tests that followed
Inside the trip settings, Escape and the backdrop no longer close the dialog while the date question is up, and the embedded form does not load the members it does not show. Every trip open is timed afresh for the splash. The tests follow the cover image card, the danger button, the delayed splash and the open and download mocks.
This commit is contained in:
@@ -152,7 +152,7 @@ describe('TripFormModal', () => {
|
||||
|
||||
it('FE-COMP-TRIPFORM-013: shows Cover Image section', () => {
|
||||
render(<TripFormModal {...defaultProps} />);
|
||||
expect(screen.getByText('Cover Image')).toBeInTheDocument();
|
||||
expect(screen.getByText('Cover image')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-COMP-TRIPFORM-014: shows start and end date labels', () => {
|
||||
@@ -538,7 +538,7 @@ describe('TripFormModal', () => {
|
||||
it('FE-COMP-TRIPFORM-040: a users payload without a list hides the member section', async () => {
|
||||
server.use(http.get('/api/auth/users', () => HttpResponse.json({})));
|
||||
render(<TripFormModal {...defaultProps} trip={null} />);
|
||||
await screen.findByText('Cover Image');
|
||||
await screen.findByText('Cover image');
|
||||
expect(screen.queryByText('Travel buddies')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -910,7 +910,7 @@ describe('TripFormModal', () => {
|
||||
seedStore(usePermissionsStore, { permissions: { trip_cover_upload: 'admin', trip_edit: 'admin' } });
|
||||
render(<TripFormModal {...defaultProps} trip={buildTrip({ id: 1, user_id: 7, title: 'Locked' })} />);
|
||||
|
||||
expect(screen.queryByText('Cover Image')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('Cover image')).not.toBeInTheDocument();
|
||||
fireEvent.paste(document.querySelector('form')!, {
|
||||
clipboardData: { items: [{ type: 'image/png', getAsFile: () => pngFile() }] },
|
||||
});
|
||||
@@ -1365,7 +1365,7 @@ describe('TripFormModal', () => {
|
||||
// No start moved, so no shift question.
|
||||
expect(screen.queryByText('Keep bookings on their dates')).not.toBeInTheDocument();
|
||||
// The longest confirm label of any language stays on one line.
|
||||
expect(screen.getByRole('button', { name: 'Remove days and save' })).toHaveClass('bg-danger', 'whitespace-nowrap');
|
||||
expect(screen.getByRole('button', { name: 'Remove days and save' })).toHaveClass('bg-danger');
|
||||
expect(onSave).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -79,6 +79,7 @@ function OpenDialog({ onClose, tripId, tripTitle, onMembersChanged, editTrip }:
|
||||
const m = useTripMembers({ isOpen: true, tripId, onClose, onMembersChanged })
|
||||
const [ask, setAsk] = useState<Ask | null>(null)
|
||||
const [area, setArea] = useState<Area>('people')
|
||||
const [tripReviewing, setTripReviewing] = useState(false)
|
||||
const journalSection = useTripJournalSectionVisible(tripId)
|
||||
const shows: Record<Area, boolean> = { people: true, sharing: m.canManageShare, journal: journalSection, trip: !!editTrip }
|
||||
const areas = AREAS.filter(a => shows[a.id])
|
||||
@@ -93,7 +94,7 @@ function OpenDialog({ onClose, tripId, tripTitle, onMembersChanged, editTrip }:
|
||||
onClose={onClose}
|
||||
labelledBy={labelId}
|
||||
width={withNav ? 'wide' : 'detail'}
|
||||
blocked={!!ask}
|
||||
blocked={!!ask || tripReviewing}
|
||||
bodyClassName={BODY}
|
||||
header={(
|
||||
<DialogHeader
|
||||
@@ -133,7 +134,7 @@ function OpenDialog({ onClose, tripId, tripTitle, onMembersChanged, editTrip }:
|
||||
)}
|
||||
{editTrip && (
|
||||
<AreaPanel area={panelOf('trip')} shown={current.id === 'trip'} titled>
|
||||
<TripFormModal embedded isOpen onClose={onClose} {...editTrip} />
|
||||
<TripFormModal embedded isOpen onClose={onClose} onReviewChange={setTripReviewing} {...editTrip} />
|
||||
</AreaPanel>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -60,4 +60,4 @@ export function useTripSplashBeats({ liveReducedMotion }: TripSplashBeatsOptions
|
||||
* slower one gets the splash right after, so a slow connection never sees the
|
||||
* app stand still.
|
||||
*/
|
||||
export const TRIP_SPLASH_AFTER_MS = 400
|
||||
export const TRIP_SPLASH_AFTER_MS = 400;
|
||||
|
||||
Reference in New Issue
Block a user