feat(editor): references side panel with filter, search and counts

Non-modal panel in a relative container after the tab row (scrim over the
tab panels, which are inert while it is open). Chip "Citées par" opened
from a finding's Citations block, "Tout afficher (N)", accent- and
case-insensitive search on citation, DOI and URL, "citée n fois" per card
(citationCounts, memoised TS read; the core stays the authority for
refused deletions). Up/down only without filter or search. "Aller à" a
reference clears a hiding search then focuses the card.

Rewritten assertions (R-24): editor-shell "the references panel keeps its
form text and no id repeats" closes the panel before reaching the inert
tab panels. Added: Chromium clickability at 1 024 and 1 280 px (top and
scrolled), editor-structures count and search, unit
editor-references-panel, editor-citations, navigation clear_cited_by.
This commit is contained in:
bchanot committed 2026-11-08 17:33:26 +01:00
1 parent cf9c300c80
commit ab51ea764d
19 files changed
+891 -85

No files matched your search

+39
View File
@@ -90,6 +90,8 @@ test.describe('editor shell, kept places (B2a)', () => {
await expect(page.locator('#reference-new-citation')).toHaveValue(
'Smith 1999',
)
// The tab panels are inert while the panel is open (AC3): close it to reach them.
await closeReferences(page, dict)
for (const tab of ['general', 'findings', 'verification']) {
await selectTab(page, dict, tab)
}
@@ -103,6 +105,43 @@ test.describe('editor shell, kept places (B2a)', () => {
expect(repeated).toEqual([])
})
for (const width of [1024, 1280]) {
test(`the open references panel leaves the header and the tab row clickable at ${width} px`, async ({
page,
}) => {
await page.setViewportSize({ width, height: 800 })
await open(page)
await openReferences(page, dict)
await page.locator('#reference-new-type').selectOption('book')
await page.locator('#reference-new-citation').fill('Smith 1999')
await page
.getByRole('button', { name: dict['editor.reference.add'] })
.click()
const header = page.locator('main header').first()
const tabs = page.getByRole('tablist')
const panel = place(page, 'references')
const targets = [
page.getByRole('button', { name: dict['common.save'], exact: true }),
page.getByRole('button', {
name: dict['editor.references.open'],
exact: true,
}),
page.getByRole('tab', {
name: new RegExp(`^${dict['editor.tab.findings']}`),
}),
]
for (const scrolled of [false, true]) {
await page.evaluate((y) => window.scrollTo(0, y), scrolled ? 400 : 0)
for (const target of targets) await target.click({ trial: true })
const box = await panel.boundingBox()
for (const above of [header, tabs]) {
const other = await above.boundingBox()
expect(box!.y).toBeGreaterThanOrEqual(other!.y + other!.height - 1)
}
}
})
}
test('focus lands on a named element after a tab click, « Retour au dessin » and « Aller à »', async ({
page,
}) => {
@@ -8,6 +8,7 @@ import {
editorActor,
openEditor,
openReferences,
place,
openSection,
pickAnnotation,
pointOf,
@@ -88,6 +89,17 @@ test.describe('editor structures (A4)', () => {
'[id^="reference-"][id$="-citation"]:not(#reference-new-citation)',
)
await expect(citations).toHaveCount(2)
await expect(
place(page, 'references').getByText('citée 0 fois'),
).toHaveCount(2)
await page
.getByRole('searchbox', { name: dict['editor.references.search'] })
.fill('seconde')
await expect(citations).toHaveCount(1)
await page
.getByRole('searchbox', { name: dict['editor.references.search'] })
.fill('')
await expect(citations).toHaveCount(2)
await page
.getByRole('listitem')
.filter({ hasText: 'Seconde référence' })