diff --git a/client/src/components/Planner/bookings/transitParts.test.tsx b/client/src/components/Planner/bookings/transitParts.test.tsx index 493ac0111..f5ef4f58b 100644 --- a/client/src/components/Planner/bookings/transitParts.test.tsx +++ b/client/src/components/Planner/bookings/transitParts.test.tsx @@ -54,6 +54,14 @@ describe('TransitLegs', () => { expect(screen.getByText('BVG')).toBeInTheDocument(); }); + it('FE-PLANNER-BKTRANSIT-009: stop names and a walk target wrap instead of being cut off (#3139)', () => { + render(); + for (const text of ['Alexanderplatz', 'Eberswalder Str.', 'Walk to Mauerpark']) { + expect(screen.getByText(text)).not.toHaveClass('truncate'); + expect(screen.getByText(text)).toHaveClass('break-words'); + } + }); + it('FE-PLANNER-BKTRANSIT-006: a walk reads as one and leaves out the ride facts', () => { render(); expect(screen.getByText('Walk to Mauerpark')).toBeInTheDocument(); diff --git a/client/src/components/Planner/bookings/transitParts.tsx b/client/src/components/Planner/bookings/transitParts.tsx index ec2057bdf..28dda974a 100644 --- a/client/src/components/Planner/bookings/transitParts.tsx +++ b/client/src/components/Planner/bookings/transitParts.tsx @@ -48,9 +48,11 @@ export function TransitLegs({ legs, compact = false }: { legs: TransitLegDisplay }}>{leg.line || leg.mode} )}
-
- {walk ? {t('transit.walkTo', { name: leg.to?.name || '' })} : ( - <>{leg.from?.name}{leg.to?.name} + {/* Detail views show a stop name whole: the names wrap and the + arrow moves to the next line with them when it has to (#3139). */} +
+ {walk ? {t('transit.walkTo', { name: leg.to?.name || '' })} : ( + <>{leg.from?.name}{leg.to?.name} )}
- - {isWalk ? '' : leg.from?.time?.slice(0, 5) || ''} + {/* A ride's departure stands beside its stops, its arrival at the + bottom of its row, so the open card holds the whole journey (#3139). */} + + {isWalk ? '' : leg.from?.time?.slice(0, 5) || ''} + {!isWalk && leg.to?.time && {leg.to.time.slice(0, 5)}}
{isWalk ? ( @@ -371,16 +374,16 @@ function TransitLegRows({ legs, t }: { legs: TransitLegDisplay[]; t: Translation
{isWalk ? ( -
+
{[mins ? t('transit.min', { count: mins }) : '', t('transit.walkTo', { name: leg.to?.name || '' })] .filter(Boolean).join(' · ')}
) : (
-
- - +
+ + {flowText([leg.from?.name, leg.to?.name].filter((n): n is string => !!n))}
diff --git a/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx b/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx index 326449d15..392dcc909 100644 --- a/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx +++ b/client/src/mobile/screens/trip/sheets/MTransportSheet.tsx @@ -236,7 +236,7 @@ export default function MTransportSheet({ planner, shell }: MTripSheetsProps) {
} - title={{res.title}} + title={{res.title}} sub={subParts.length > 0 ? subParts.join(' · ') : undefined} onClose={shell.closeSheet} closeLabel={t('common.close')} @@ -314,9 +314,9 @@ export default function MTransportSheet({ planner, shell }: MTripSheetsProps) { {t('transit.walkTo', { name: leg.to?.name || '' })} ) : ( <> - {leg.from?.name} + {leg.from?.name} - {leg.to?.name} + {leg.to?.name} )}
diff --git a/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx b/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx index c4f60b9e3..e849dad78 100644 --- a/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx +++ b/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx @@ -327,6 +327,18 @@ describe('TransitRow', () => { expect(screen.getByText('transit.min:1 · transit.walkTo:Hotel')).toBeInTheDocument() }) + it('FE-MOB-PLROW-046: the expanded legs show every stop name in full and each ride arrival time (#3139)', () => { + const { container } = render() + + const ride = screen.getByText('Shibuya Sta. → Asakusa Sta.') + expect(ride).not.toHaveClass('truncate') + expect(ride).toHaveClass('break-words') + expect(screen.getByText('transit.min:4 · transit.walkTo:Shibuya Sta.')).not.toHaveClass('truncate') + expect(screen.getByText('10:30')).toBeInTheDocument() + // the departure keeps its place beside the arrival + expect(container.textContent).toContain('10:05') + }) + it('FE-MOB-PLROW-024: tapping the header toggles the row', () => { const onToggle = vi.fn() render() diff --git a/client/tests/unit/mobile/trip/MTransportSheet.test.tsx b/client/tests/unit/mobile/trip/MTransportSheet.test.tsx index 12ef4f3a9..60d1ab98b 100644 --- a/client/tests/unit/mobile/trip/MTransportSheet.test.tsx +++ b/client/tests/unit/mobile/trip/MTransportSheet.test.tsx @@ -144,6 +144,24 @@ describe('MTransportSheet', () => { expect(screen.getByText('Prater')).toBeInTheDocument() }) + it('FE-MOB-TRSH-025: the title and every stop name wrap instead of being cut off (#3139)', () => { + const res = { + ...FLIGHT, type: 'transit', title: 'Basingstoke station → Reading station', endpoints: [], metadata: { + transit: { + legs: [{ + mode: 'RAIL', line: 'CrossCountry', duration: 1260, + from: { name: 'Basingstoke', time: '12:48' }, to: { name: 'Reading', time: '13:09' }, + }], + }, + }, + } as unknown as Reservation + render() + expect(screen.getByText('Basingstoke station → Reading station')).not.toHaveClass('truncate') + expect(screen.getByText('Basingstoke')).not.toHaveClass('truncate') + expect(screen.getByText('Reading')).not.toHaveClass('truncate') + expect(screen.getByText('Reading')).toHaveClass('break-words') + }) + it('FE-MOB-TRSH-010: shows the pending status and the booking code unblurred by default', () => { render() expect(screen.getByText('Pending')).toBeInTheDocument()