/** * Test page for the shared Dialog in a real browser (e2e/ui/dialog.spec.ts). * Served by the Vite dev server only (`/e2e/harness/dialog.html`); the build * has a single entry, index.html, so this page never ships. Each scenario is a * case of the D13 contract, not a product journey: `?lang=en` picks the language. */ import { StrictMode, useState } from 'react' import { createRoot } from 'react-dom/client' import '@/styles/index.css' import Button from '@/components/ui/Button' import Dialog from '@/components/ui/Dialog' import { useLocaleStore } from '@/state/localeStore' import type { Locale } from '@/i18n/types' const lang: Locale = new URLSearchParams(location.search).get('lang') === 'en' ? 'en' : 'fr' useLocaleStore.setState({ locale: lang }) document.documentElement.lang = lang type Scenario = 'basic' | 'long' | 'guarded' | 'vanishing' | null function Background({ onOpen }: { onOpen: (scenario: Scenario) => void }) { const [clicks, setClicks] = useState(0) return (

{clicks}

) } function Harness() { const [scenario, setScenario] = useState(null) const [busy, setBusy] = useState(true) const [item, setItem] = useState(true) const close = () => setScenario(null) return (

Dialog harness

{item && ( )}
{/* Taller than any viewport: the page would scroll if the dialog let it. */}
) } createRoot(document.getElementById('root') as HTMLElement).render( , )