fix(editor): never drop a refused draft silently on a read-only flip

Drop slot is tile-local state; the edit view cleanup reports every pending
field (FIELDS order) only when some are pending. The tile shows a warning
note and says it once in the live region; it ends on toggle, Terminer or a
newer drop. LeaveGuard returns all refused fields (forced panel close names
them all). Pin follows editingKey through read-only; reset re-pins it.
Read-only toggle ends edit and collapses. Flip focus goes to the tile header.

R-24 mapping:
- view test "keeps its index ... read-only (M3)": renamed, same assertion
- view test "is suspended in read-only ...": rewritten as "stays pinned in
  read-only" (pin kept, tile still shown after a search); toggle test added
- reset test extended: tile in edit stays pinned through the reset
- new editor-references-flip.test.tsx covers (a)-(g); (h) is a stated limit
This commit is contained in:
bchanot committed 2026-11-13 11:11:51 +01:00
1 parent 52aac41472
commit 3303530717
15 files changed
+543 -94

No files matched your search

+6 -2
View File
@@ -1,3 +1,4 @@
import { StrictMode } from 'react'
import { render } from '@testing-library/react'
import { MemoryRouter, Route, Routes } from 'react-router-dom'
import {
@@ -89,6 +90,8 @@ export interface MountOptions {
answer?: Record<string, unknown>
/** The admin read is refused with this closed kind. */
adminFailure?: SheetFailureKind
/** Renders inside <StrictMode>: effects run twice on mount, as in development. */
strict?: boolean
}
/** Mounts the draft route as an editor with the admin role, at a wide screen, by default. */
@@ -111,7 +114,7 @@ export function mountDraft(options: MountOptions = {}) {
(options.answer ?? adminAnswer()) as never,
)
}
return render(
const page = (
<MemoryRouter initialEntries={[`/app/admin/sheets/${SHEET}/draft`]}>
<Routes>
<Route
@@ -123,6 +126,7 @@ export function mountDraft(options: MountOptions = {}) {
element={<p>overview page</p>}
/>
</Routes>
</MemoryRouter>,
</MemoryRouter>
)
return render(options.strict ? <StrictMode>{page}</StrictMode> : page)
}