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

@@ -443,6 +443,44 @@ test.describe('reference tiles, search, sort and add', () => {
libraryRoot(page).getByLabel(dict['editor.reference.citation']),
).toBeVisible()
})
test('a refused draft is never dropped silently by a read-only flip', async ({
page,
}) => {
test.setTimeout(150_000)
await open(page)
await openTab(page, dict, 'references')
const bar = toolbar(page)
await headers(page).nth(REF_DOI).click()
const tile = libraryRoot(page)
.locator('button[id$="-ref-doi-header"]')
.locator('xpath=ancestor::li[1]')
await tile
.getByRole('button', { name: dict['editor.references.edit'] })
.click()
await bar.search.fill('libre')
const url = tile.getByLabel(dict['editor.reference.url'])
await url.fill('exemple.org')
const note = dict['editor.references.draft_dropped'].replace(
'{field}',
dict['editor.reference.url'],
)
const size = page.viewportSize() ?? { width: 1280, height: 900 }
await page.setViewportSize({ width: 800, height: size.height })
await expect(tile.getByText(note)).toBeVisible()
await expect(page.locator('p.sr-only[aria-live="polite"]')).toHaveText(note)
await expect(url).toHaveCount(0)
await page.setViewportSize(size)
await expect(tile.getByText(note)).toBeVisible()
await expect(url).toHaveValue(`https://doi.org/${DOI}`)
await tile
.getByRole('button', {
name: dict['editor.references.done'],
exact: true,
})
.click()
await expect(tile.getByText(note)).toHaveCount(0)
})
})
test.describe('reference tiles, read-only at 375 px', () => {