/** * Test page for the interior rule in a real browser (e2e/ui/interior-clicks.spec.ts): the * canvas the core composes for one probe case (e2e/fixtures/interior-probe.json, generated by * crates/core/tests/interior_probe.rs) in the phone preview's 286 × 310 box, inserted as the * editor inserts it (DOMParser, importNode), every click on a marker recorded. Served by the * Vite dev server only (`/e2e/harness/interior.html?case=`); the build never ships it. */ import probe from '../fixtures/interior-probe.json' const name = new URLSearchParams(location.search).get('case') const found = probe.cases.find((c) => c.name === name) if (!found) throw new Error(`no probe case ${String(name)}`) const root = document.getElementById('root') as HTMLElement const clicks = document.createElement('output') clicks.dataset.testid = 'clicks' clicks.style.cssText = 'display:block;height:24px;overflow:hidden' const box = document.createElement('div') box.dataset.testid = 'preview' box.style.cssText = `width:${probe.frame.width}px;height:${probe.frame.height}px` const parsed = new DOMParser().parseFromString(found.svg, 'image/svg+xml') const svg = document.importNode( parsed.documentElement, true, ) as unknown as SVGSVGElement svg.style.cssText = 'display:block;width:100%;height:100%' box.append(svg) root.append(clicks, box) box.addEventListener('click', (event) => { const marker = (event.target as Element).closest('[data-anno-id]') const id = marker?.getAttribute('data-anno-id') if (id) clicks.textContent = `${clicks.textContent ?? ''} ${id}`.trim() })