mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 17:03:15 +00:00
style(client): prettier on the files this branch touched
This commit is contained in:
@@ -1,19 +1,39 @@
|
||||
// FE-PLANNER-BKPARTS-001 to FE-PLANNER-BKPARTS-002
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { WhenFields } from './bookingParts';
|
||||
import type { BookingFacts } from './bookingFacts';
|
||||
import { WhenFields } from './bookingParts';
|
||||
|
||||
function facts(day: BookingFacts['day'], time: string | null = '15:35 → 09:55'): BookingFacts {
|
||||
return {
|
||||
day, time, startTime: null, endTime: null, startDate: null, endDate: null,
|
||||
cells: [], endpoints: [], legCodes: [], place: null, accommodation: null, linked: null, url: null, isHotel: false,
|
||||
day,
|
||||
time,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
cells: [],
|
||||
endpoints: [],
|
||||
legCodes: [],
|
||||
place: null,
|
||||
accommodation: null,
|
||||
linked: null,
|
||||
url: null,
|
||||
isHotel: false,
|
||||
};
|
||||
}
|
||||
|
||||
describe('WhenFields', () => {
|
||||
it('FE-PLANNER-BKPARTS-001: a long day title is cut, the date beside it never shrinks (#2590)', () => {
|
||||
render(<WhenFields facts={facts({ label: 'Germany Departure Flight with a much longer custom title → Korea Arrival', date: 'Oct 21 → Oct 22', range: true })} />);
|
||||
render(
|
||||
<WhenFields
|
||||
facts={facts({
|
||||
label: 'Germany Departure Flight with a much longer custom title → Korea Arrival',
|
||||
date: 'Oct 21 → Oct 22',
|
||||
range: true,
|
||||
})}
|
||||
/>
|
||||
);
|
||||
|
||||
const title = screen.getByText('Germany Departure Flight with a much longer custom title → Korea Arrival');
|
||||
const date = screen.getByText('Oct 21 → Oct 22');
|
||||
|
||||
@@ -181,16 +181,24 @@ describe('reservation dates', () => {
|
||||
expect(endTimeBeforeStartTime(overnight)).toBe(true);
|
||||
// Time zones can make a booking end "before" it starts, so the save stays open.
|
||||
expect(isEndBeforeStart(overnight)).toBe(false);
|
||||
expect(endTimeBeforeStartTime(form({ reservation_time: '2026-11-24T09:00', reservation_end_time: '18:00' }))).toBe(false);
|
||||
expect(endTimeBeforeStartTime(form({ reservation_time: '2026-11-24T18:00', reservation_end_time: '18:00' }))).toBe(false);
|
||||
expect(endTimeBeforeStartTime(form({ reservation_time: '2026-11-24T09:00', reservation_end_time: '18:00' }))).toBe(
|
||||
false
|
||||
);
|
||||
expect(endTimeBeforeStartTime(form({ reservation_time: '2026-11-24T18:00', reservation_end_time: '18:00' }))).toBe(
|
||||
false
|
||||
);
|
||||
// With the next day as end date the times are fine, and an end date of its own is checked by isEndBeforeStart.
|
||||
expect(
|
||||
endTimeBeforeStartTime(form({ reservation_time: '2026-11-24T18:00', end_date: '2026-11-25', reservation_end_time: '09:00' }))
|
||||
endTimeBeforeStartTime(
|
||||
form({ reservation_time: '2026-11-24T18:00', end_date: '2026-11-25', reservation_end_time: '09:00' })
|
||||
)
|
||||
).toBe(false);
|
||||
expect(endTimeBeforeStartTime(form({ reservation_time: '2026-11-24', reservation_end_time: '09:00' }))).toBe(false);
|
||||
expect(endTimeBeforeStartTime(form({ reservation_end_time: '09:00' }))).toBe(false);
|
||||
expect(
|
||||
endTimeBeforeStartTime(form({ type: 'hotel', reservation_time: '2026-11-24T18:00', reservation_end_time: '09:00' }))
|
||||
endTimeBeforeStartTime(
|
||||
form({ type: 'hotel', reservation_time: '2026-11-24T18:00', reservation_end_time: '09:00' })
|
||||
)
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user