From 0d521f0930640c6fb35da16312b8e344436b7b7a Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 1 Dec 2026 11:42:31 +0100 Subject: [PATCH] test(transit): cover long labels in both journey details Exercise a line with a provider colour and no foreground override on desktop and phone. Confirm that the badge can wrap and leaves room for the rest of the itinerary. --- .../Planner/TransitJourneyModal.test.tsx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/client/src/components/Planner/TransitJourneyModal.test.tsx b/client/src/components/Planner/TransitJourneyModal.test.tsx index a52fa94d5..3f1661e96 100644 --- a/client/src/components/Planner/TransitJourneyModal.test.tsx +++ b/client/src/components/Planner/TransitJourneyModal.test.tsx @@ -60,6 +60,19 @@ describe('TransitJourneyModal', () => { expect(screen.getByText(/BVG/)).toBeInTheDocument() }) + it('FE-PLANNER-TRANSITJOURNEY-019: keeps room for both desktop stops beside a long line name', () => { + const reservation = makeReservation() + const line = 'Melbourne Airport Express via Southern Cross' + reservation.metadata.transit.legs[1] = { ...reservation.metadata.transit.legs[1], line, line_text_color: undefined } + render() + + const label = screen.getByText(line) + expect(label.parentElement).toHaveStyle({ maxInlineSize: '40%', color: '#fff' }) + expect(label).toHaveClass('[overflow-wrap:anywhere]') + expect(screen.getAllByText('Alexanderplatz').length).toBeGreaterThan(0) + expect(screen.getAllByText('Zoo').length).toBeGreaterThan(0) + }) + it('FE-PLANNER-TRANSITJOURNEY-002: inline title rename + notes save as a minimal field payload', async () => { const user = userEvent.setup() const onSave = vi.fn().mockResolvedValue({}) @@ -263,6 +276,18 @@ describe('TransitJourneyModal (mobile viewport)', () => { expect(screen.getByText('Kudamm')).toBeInTheDocument() }) + it('FE-PLANNER-TRANSITJOURNEY-020: wraps a long phone badge while keeping its headsign visible', () => { + const reservation = makeMobileReservation() + const line = 'Melbourne Airport Express via Southern Cross' + reservation.metadata.transit.legs[1] = { ...reservation.metadata.transit.legs[1], line, line_text_color: undefined } + render() + + const label = screen.getByText(line) + expect(label.parentElement).toHaveStyle({ maxInlineSize: '40%', color: '#fff' }) + expect(label).toHaveClass('[overflow-wrap:anywhere]') + expect(screen.getByText('Ruhleben')).toBeInTheDocument() + }) + it('FE-PLANNER-TRANSITJOURNEY-016: mobile stat tiles stay iconless but keep value + caption', () => { render() expect(screen.getByText('Transfers')).toBeInTheDocument()