test(editor): keyboard-only cite and save restores in one undo

This commit is contained in:
bchanot committed 2026-11-15 20:50:49 +01:00
1 parent 3e94f732c7
commit 52d5613fe5
1 file changed
+36
@@ -533,6 +533,42 @@ test.describe('references dialog, edit mode', () => {
)
})
test('by keyboard: choose, « Citer », « Enregistrer », one « Défaire » restores', async ({
page,
}) => {
test.setTimeout(150_000)
const { seed } = await open(page)
await editCitations(page)
await citeSelect(page).focus()
await page.keyboard.press('ArrowDown')
const chosen = await citeSelect(page).inputValue()
expect(chosen).not.toBe('')
await page.keyboard.press('Tab')
const cite = inDialog(page, dict['editor.citations.cite'])
await expect(cite).toBeFocused()
await page.keyboard.press('Enter')
await expect(draftRows(page)).toHaveCount(4)
await inDialog(page, dict['editor.findings.save']).focus()
await page.keyboard.press('Enter')
await expect(editButton(page)).toBeFocused()
await closeCitations(page, dict)
await closeFinding(page, dict)
await saveDraft(page, dict, seed.revision + 1)
let saved = await serverDocument<Record<string, unknown>>(seed.draftId)
expect(nodeOf(saved).reference_ids).toEqual([
'ref-a',
'ref-b',
'ref-c',
chosen,
])
const undo = historyButton(page, dict, 'undo')
await undo.click()
await expect(undo).toHaveAttribute('aria-disabled', 'true')
await saveDraft(page, dict, seed.revision + 2)
saved = await serverDocument<Record<string, unknown>>(seed.draftId)
expect(nodeOf(saved).reference_ids).toEqual(['ref-a', 'ref-b', 'ref-c'])
})
test('the ✕ is a 44 px box beside a long title at 1280 px', async ({
page,
}) => {