mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-22 06:56:35 +00:00
fix(bookings): booking cards always show the calendar date of their linked day
Phone booking and transport cards printed only the title of the linked day, so a long title cut off in the field left no date at all. They now print the date beside the title like the desktop card, as a span that never shrinks while the title is truncated, and a day range takes the full width with the time under it. The desktop card gets the same non-shrinking date. A day without a date of its own (a trip planned without dates) now borrows the booking's start or end date, on the desktop cards, the list, the detail dialog, the shared page and the phone alike. Refs #2590
This commit is contained in:
@@ -162,18 +162,24 @@ describe('transportsModel — cardWhen', () => {
|
||||
const r = res({ reservation_time: '2026-07-01T09:05', reservation_end_time: '2026-07-03T18:30' });
|
||||
expect(cardWhen(r, day1, day3, t, 'en-US', '24h')).toEqual({
|
||||
dayValue: 'dayplan.dayN:1 – Coast',
|
||||
dayDate: 'Jul 1 – Jul 3',
|
||||
dayRange: true,
|
||||
timeValue: '09:05 – 18:30',
|
||||
});
|
||||
expect(cardWhen(r, day1, day1, t, 'en-US', '24h').dayValue).toBe('dayplan.dayN:1');
|
||||
expect(cardWhen(r, day1, day1, t, 'en-US', '24h')).toMatchObject({ dayValue: 'dayplan.dayN:1', dayDate: 'Wed, Jul 1', dayRange: false });
|
||||
});
|
||||
|
||||
it('FE-MOB-TRPM-016: without a day the booking date stands in, then a dash', () => {
|
||||
expect(cardWhen(res({ reservation_time: '2026-07-04' }), undefined, undefined, t, 'en-US', '24h')).toEqual({
|
||||
dayValue: 'Jul 4',
|
||||
dayDate: null,
|
||||
dayRange: false,
|
||||
timeValue: '—',
|
||||
});
|
||||
expect(cardWhen(res({ reservation_time: null }), undefined, undefined, t, 'en-US', '24h')).toEqual({
|
||||
dayValue: '—',
|
||||
dayDate: null,
|
||||
dayRange: false,
|
||||
timeValue: '—',
|
||||
});
|
||||
});
|
||||
@@ -182,4 +188,17 @@ describe('transportsModel — cardWhen', () => {
|
||||
const r = res({ reservation_time: '2026-07-01T14:00', reservation_end_time: null });
|
||||
expect(cardWhen(r, day1, undefined, t, 'en-US', '12h').timeValue).toBe('2:00 PM');
|
||||
});
|
||||
|
||||
it('FE-MOB-TRPM-018: a day without a date shows the booking date beside its title (#2590)', () => {
|
||||
const departure = buildDay({ id: 200, day_number: 1, title: 'Germany Departure Flight', date: null });
|
||||
const arrival = buildDay({ id: 201, day_number: 2, title: 'Korea Arrival', date: null });
|
||||
const r = res({ reservation_time: '2026-10-21T15:35', reservation_end_time: '2026-10-22T09:55' });
|
||||
expect(cardWhen(r, departure, arrival, t, 'en-US', '24h')).toEqual({
|
||||
dayValue: 'Germany Departure Flight – Korea Arrival',
|
||||
dayDate: 'Oct 21 – Oct 22',
|
||||
dayRange: true,
|
||||
timeValue: '15:35 – 09:55',
|
||||
});
|
||||
expect(cardWhen(res({ reservation_time: null }), departure, undefined, t, 'en-US', '24h').dayDate).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user