fix(editor): stale cite choice reset, pending line under the add row

This commit is contained in:
bchanot committed 2026-11-15 20:00:28 +01:00
1 parent 70eb2fcbb4
commit 1d119c3684
6 files changed
+91 -29

No files matched your search

+18 -1
View File
@@ -493,7 +493,7 @@ test.describe('references dialog, edit mode', () => {
expect(nodeOf(saved).reference_ids).toEqual(['ref-a', 'ref-b', 'ref-c'])
})
test('keyboard: ArrowDown on the select only chooses, ✕ closes without asking; axe', async ({
test('ArrowDown only chooses, a refused save stays level, ✕ asks nothing; axe', async ({
page,
}) => {
test.setTimeout(150_000)
@@ -507,6 +507,23 @@ test.describe('references dialog, edit mode', () => {
await expect(cite).toBeEnabled()
await expect(draftRows(page)).toHaveCount(3)
await expectAccessible(page, 'the edit mode with a choice not cited')
// « Enregistrer » refuses the pending choice; its line leaves both buttons level.
await inDialog(page, dict['editor.findings.save']).click()
await expect(citationsDialog(page).getByRole('alert')).toHaveText(
dict['editor.citations.pending_choice'],
)
await expect(cite).toBeFocused()
const middle = async (target: Locator) => {
const box = (await target.boundingBox())!
return box.y + box.height / 2
}
const level = await middle(citeSelect(page))
for (const control of [
cite,
inDialog(page, dict['editor.citations.new_reference']),
]) {
expect(Math.abs((await middle(control)) - level)).toBeLessThanOrEqual(2)
}
await inDialog(page, dict['common.close']).click()
await expect(page.locator('dialog[open]')).toHaveCount(1)
await expect(citationsDialog(page).getByText(confirmText)).toHaveCount(0)