Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

1.3 KB
Raw Blame
import { describe, expect, it } from 'vitest';

import { render, screen } from '../../../tests/helpers/render';
import { SharedPlaceDetails } from './SharedPlaceDetails';

/** FE-PAGE-SHARED-PLACE-001: a stop's description and notes on a shared trip, read as the planner shows them (#2692). */

describe('SharedPlaceDetails', () => {
  it('FE-PAGE-SHARED-PLACE-001: renders markdown in the description and notes, and keeps raw HTML as text', () => {
    render(
      <SharedPlaceDetails
        place={{
          name: 'Market',
          address: 'Market Square 1',
          description: [
            '## Opening',
            '',
            '| Day | Hours |',
            '| --- | --- |',
            '| Sat | 8 to 14 |',
            '',
            '<img src=x onerror=alert(1)>',
          ].join('\n'),
          notes: ['- fruit', '- bread'].join('\n'),
        }}
        assignmentNotes="**Bring** cash"
      />
    );
    expect(screen.getByRole('heading', { name: 'Opening' })).toBeInTheDocument();
    expect(screen.getByRole('cell', { name: '8 to 14' })).toBeInTheDocument();
    expect(screen.getByText('Bring').tagName).toBe('STRONG');
    expect(screen.getByText('fruit').tagName).toBe('LI');
    expect(document.querySelector('img[src="x"]')).toBeNull();
    expect(screen.queryByText('## Opening')).toBeNull();
  });
});