diff --git a/.github/contributing/testing.md b/.github/contributing/testing.md index dbf503031..cc2236674 100644 --- a/.github/contributing/testing.md +++ b/.github/contributing/testing.md @@ -312,6 +312,44 @@ often a different vitest project — from the one being re-rendered. A full `pnpm run test:update` fixes it in one pass. `test:update` exists so that the safe command is the short one, and it takes no path on purpose. +## Every case is mounted into the document, and unmounted after + +`componentRender` mounts with `attachTo: document.body` and calls `unmount()` +as soon as it has the markup. Both halves matter, and neither is the default. + +Vue Test Utils renders into a detached element. That is invisible until +something asks the document a question, and reka-ui's dialog family does: it +checks its own accessibility with `document.getElementById(titleId)` in +`onMounted`. Against a detached tree the lookup fails, so every dialog spec +rendering with `portal: false` warned that `DialogContent` requires a +`DialogTitle` — with the title sitting in the markup it had just produced. +Measured across the suite, with the register in `test/utils/console-gate.ts` +emptied on both sides: 623 console messages from 62 tests detached, 366 from 56 +attached. + +Attached, the snapshots also record what a browser would: `Header` and `Table` +gain the `aria-hidden` reka-ui puts on everything behind an open dialog, and +`CheckboxGroup`/`RadioGroup` gain the `aria-label` it reads off the associated +`