Merge pull request #2383 from liketrek/fix/mobile-markdown-place-description

fix(places): render markdown in the mobile place description
This commit is contained in:
Maurice
2026-09-17 15:31:13 +02:00
committed by GitHub
8 changed files with 122 additions and 17 deletions
@@ -10,7 +10,7 @@ import type { Assignment, Category, Day, Place, TripFile, TripMember } from '../
import { resetAllStores, seedStore } from '../../../helpers/store'
import { act, fireEvent, render, screen, waitFor } from '../../../helpers/render'
// FE-MOB-PLSH-001 to FE-MOB-PLSH-025
// FE-MOB-PLSH-001 to FE-MOB-PLSH-032
vi.mock('../../../../src/utils/fileDownload', () => ({ openFile: vi.fn() }))
@@ -506,6 +506,19 @@ describe('MPlaceSheet', () => {
expect(row.disabled).toBe(true)
})
it('FE-MOB-PLSH-032: the description and the note are rendered markdown, as on the desktop inspector (#2337)', () => {
const marked = {
...PLACE,
description: '# Kunsthistorisches\n\nThe **Habsburg** collections.',
notes: 'Book the *skip-the-line* ticket',
} as unknown as Place
renderSheet(makePlanner({ selectedPlace: marked }) as unknown as TripPlanner)
expect(screen.getByRole('heading', { name: 'Kunsthistorisches' })).toBeInTheDocument()
expect(screen.getByText('Habsburg').tagName).toBe('STRONG')
expect(screen.getByText('skip-the-line').tagName).toBe('EM')
})
it('FE-MOB-PLSH-031: a booking on another assignment is not shown here', () => {
renderSheet(bookingPlanner({ id: 9, assignment_id: 999, title: 'Someone elses ferry', status: 'pending', type: 'ferry' }))
@@ -10,7 +10,7 @@ import { resetAllStores, seedStore } from '../../../helpers/store'
import type { MTripShellApi, TripPlanner } from '../../../../src/mobile/screens/trip/MTripShell'
import type { AssignmentsMap, Category, Day, Place } from '../../../../src/types'
// FE-MOB-PBROW-001 to FE-MOB-PBROW-030
// FE-MOB-PBROW-001 to FE-MOB-PBROW-031
const CATEGORIES = [
{ id: 1, name: 'Sights', color: '#123456', icon: 'landmark' },
@@ -382,6 +382,14 @@ describe('MPlacesBrowser', () => {
expect(screen.getByText('places.selectionCount:2')).toBeInTheDocument()
})
it('FE-MOB-PBROW-031: a markdown description in a row reads as formatted text, not as syntax (#2337)', () => {
const CHARLIE = place({ id: 4, name: 'Checkpoint Charlie', description: '# Checkpoint Charlie\n\nThe **most famous** crossing.' })
renderBrowser(makePlanner({ places: [CHARLIE], assignments: {} } as Partial<TripPlanner>))
expect(screen.getByRole('heading', { name: 'Checkpoint Charlie' })).toBeInTheDocument()
expect(screen.queryByText(/^# Checkpoint/)).toBeNull()
})
it('FE-MOB-PBROW-030: a selection that only matches the visible pool in size is not "all selected"', () => {
renderBrowser()
fireEvent.click(screen.getByRole('button', { name: 'common.select' }))