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.
This commit is contained in:
Maurice
2026-12-01 11:42:31 +01:00
parent 7fc011408a
commit 0d521f0930
@@ -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(<TransitJourneyModal {...makeProps({ reservation })} />)
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(<TransitJourneyModal {...makeProps({ reservation })} />)
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(<TransitJourneyModal {...makeProps({ reservation: makeMobileReservation() })} />)
expect(screen.getByText('Transfers')).toBeInTheDocument()