feat(editor): collapsible reference tiles in the Références tab
Board 23 / 24 / 27 tiles: closed (citation on two lines, type, « Citée
{n} fois » / « Non citée »), open (Type, DOI, URL as safe links, the
citers with « famille » badge and « Aller à »), edit (« Terminer » with a
leave guard re-committing every changed field; a refusal keeps edit
and focuses the field). A cited reference shows the deletion hint, an
uncited one keeps « Supprimer ». Read-only keeps DOI, URL, « Aller à ».
« Terminer » keeps focus in the field on press, so a refusal message
can no longer move the button under the pointer.
Gates: typecheck, lint, test:run (app 1419), build, e2e:ui 251;
e2e:shell 16 specs on db:sandbox (editor-equine never listed): 111
passed / 99 skipped / 3 failed in the new editor-references.spec (two
test bugs, one app bug), fixed and rerun: 5 passed / 4 skipped; full-row
guard: no pre-existing row changed in any table.
## R-24 (removed or rewritten assertions)
| file | old | new |
|---|---|---|
| editor-citations.test.ts | `citationCounts` counts 2/1/0, memoised, empty | `citersOf`: ordered citers (Cat, Node), family flag, trail from zone, key, memoised, empty |
| editor-references-tab.test.tsx | cards say « citée N fois » (ref-a 1, ref-c 0) | « Citée 2 fois » (fixture gains a node citing ref-a), « Citée 1 fois », « Non citée » |
| same | ids `#tab-reference-ref-a-citation` exist when closed | header id `#tab-reference-0-ref-a-header`; field ids only inside an open edit tile |
| same | ↑/↓ on every card | in open tiles only, absent under a search |
| same | Ctrl+Z on an always-visible field | open tile, Modifier, then same assertion on `#tab-reference-0-ref-a-citation` |
| same | « Aller à » focuses the card (`listitem` count 3, focus key) | tile opened (aria-expanded true), header focused, 3 tiles |
| same | add: `getByText('Nouvelle source')` | tile header named « Nouvelle source » |
| same | read-only: no Supprimer / add | same after opening every tile |
| editor-tabs-lists.test.tsx | edit on blur and arrows on always-open cards | open tile, Modifier, blur applies, Terminer, Monter on opened tile |
| same | cited reference deletion refused in a dialog listing citers | REMOVED: no Supprimer on a cited tile (hint asserted, citer listed); uncited delete kept. The dialog's blocked path stays covered by `DeleteDialog`'s own tests |
| same | read-only: no button at all | read-only: facts shown, no Modifier / Supprimer / Citation textbox (header buttons exist now) |
| editor-keep-alive.test.tsx:~330 | tab-click commit of `#tab-reference-ref-1-citation` | opens tile + Modifier first, id `#tab-reference-0-ref-1-citation` |
| editor-keep-alive.test.tsx:~350,367 | `#panel-reference-ref-1-citation` | `#panel-reference-0-ref-1-citation` |
| editor-references-panel.test.tsx | « citée 2 fois / 1 fois » | « Citée 2 fois / 1 fois » |
| same | `#panel-reference-ref-a-citation`; no `#tab-reference-ref-a-citation` | `#panel-reference-0-ref-a-citation`; no `[id^="tab-reference-"]` while the tab tiles are closed |
| same | ids unique, tab and panel field ids present | tab tile opened in edit first; `tab-reference-0-ref-a-citation` and `panel-reference-0-ref-a-citation` unique |
| e2e editor-structures.spec.ts:~88-110 | citation inputs count 3/1/2, « citée 0 fois » x2, « citée 1 fois », move via row buttons | tile headers count, « Non citée » x2, « Citée 1 fois », tile opened before Monter/Supprimer, `tiles.nth(1)` contains the moved text (saved-list assertion unchanged) |
## i18n (fr / en)
Changed (in place, P18): `editor.references.cited_one|other`: « citée {count} fois » -> « Citée {count} fois »; « cited {count} time(s) » -> « Cited {count} time(s) ».
Added: `editor.references.uncited` Non citée / Not cited; `citers_one|other` « Citée {count} fois, par : » / « Cited {count} time(s), by: »; `no_citers` « Aucun constat ni aucune famille ne cite cette référence. » / « No finding or family cites this reference. »; `family` famille / family; `go_to` Aller à / Go to; `edit` Modifier / Edit; `done` Terminer / Done; `edit_title` Modifier la référence / Edit the reference; `url_label` URL / URL; `none_doi` Aucun / None; `none_url` Aucune / None; `new_tab` (nouvel onglet) / (new tab) (sr-only); `delete_hint` (REVUE wording, fr and en).
Removed: none. R10 grep (src, tests, e2e incl. editor-equine) found no reader of the old lowercase wording left.
This commit is contained in:
1 parent
4499bc740c
commit
c21995b3fb
26 files changed
+1532
-155
No files matched your search
@@ -65,7 +65,7 @@ describe('Références', () => {
|
||||
expect(doc().references[0].id).toMatch(/^ref-[a-z2-7]{10}$/)
|
||||
})
|
||||
|
||||
it('edits a field on blur and reorders with the arrows', async () => {
|
||||
it('edits a field in a tile, applies it on blur, and reorders with the arrows', async () => {
|
||||
const text = insert(
|
||||
insert(baseText(), reference('ref-a', 'Alpha')),
|
||||
reference('ref-b', 'Beta'),
|
||||
@@ -73,18 +73,22 @@ describe('Références', () => {
|
||||
await openReady({ text })
|
||||
const user = userEvent.setup()
|
||||
render(<ReferencesTab {...props} />)
|
||||
await user.click(screen.getByRole('button', { name: /^Alpha/ }))
|
||||
await user.click(screen.getByRole('button', { name: 'Modifier' }))
|
||||
const url = screen.getByLabelText('Adresse web (URL)', {
|
||||
selector: '#tab-reference-ref-a-url',
|
||||
selector: '#tab-reference-0-ref-a-url',
|
||||
})
|
||||
await user.type(url, 'https://example.org')
|
||||
await user.tab()
|
||||
expect(doc().references[0].url).toBe('https://example.org')
|
||||
await user.click(screen.getByRole('button', { name: 'Terminer' }))
|
||||
await user.click(screen.getByRole('button', { name: /^Beta/ }))
|
||||
await user.click(screen.getAllByRole('button', { name: 'Monter' })[1])
|
||||
expect(doc().references.map((r) => r.id)).toEqual(['ref-b', 'ref-a'])
|
||||
expect(screen.getAllByRole('button', { name: 'Monter' })[0]).toBeDisabled()
|
||||
})
|
||||
|
||||
it('a cited reference is refused with the citing findings listed; an uncited one is deleted', async () => {
|
||||
it('a cited reference offers no deletion, only the hint; an uncited one is deleted', async () => {
|
||||
let text = insert(
|
||||
insert(baseText(), reference('ref-a', 'Alpha')),
|
||||
reference('ref-b', 'Beta'),
|
||||
@@ -112,25 +116,26 @@ describe('Références', () => {
|
||||
await openReady({ text })
|
||||
const user = userEvent.setup()
|
||||
render(<ReferencesTab {...props} />)
|
||||
await user.click(screen.getAllByRole('button', { name: 'Supprimer' })[0])
|
||||
const refused = await screen.findByRole('dialog')
|
||||
expect(within(refused).getByText(/cite cette référence/)).toBeTruthy()
|
||||
expect(within(refused).getByText(/Boiterie/)).toBeTruthy()
|
||||
await user.click(
|
||||
within(refused).getAllByRole('button', { name: 'Fermer' }).at(-1)!,
|
||||
)
|
||||
await user.click(screen.getAllByRole('button', { name: 'Supprimer' })[1])
|
||||
await user.click(screen.getByRole('button', { name: /^Alpha/ }))
|
||||
expect(screen.queryByRole('button', { name: 'Supprimer' })).toBeNull()
|
||||
expect(screen.getByText(/Pour supprimer cette référence/)).toBeTruthy()
|
||||
expect(screen.getByText('Boiterie')).toBeTruthy()
|
||||
await user.click(screen.getByRole('button', { name: /^Beta/ }))
|
||||
await user.click(screen.getByRole('button', { name: 'Supprimer' }))
|
||||
const asked = await screen.findByRole('dialog')
|
||||
await user.click(within(asked).getByRole('button', { name: 'Supprimer' }))
|
||||
expect(doc().references.map((r) => r.id)).toEqual(['ref-a'])
|
||||
})
|
||||
|
||||
it('read-only shows the citations as text', async () => {
|
||||
it('read-only shows the facts and no control that changes the draft', async () => {
|
||||
await openReady({ text: insert(baseText(), reference('ref-a', 'Alpha')) })
|
||||
const user = userEvent.setup()
|
||||
render(<ReferencesTab {...props} readOnly />)
|
||||
expect(screen.getByText('Alpha')).toBeTruthy()
|
||||
expect(screen.queryByRole('textbox')).toBeNull()
|
||||
expect(screen.queryAllByRole('button')).toEqual([])
|
||||
await user.click(screen.getByRole('button', { name: /^Alpha/ }))
|
||||
expect(screen.getByText('Aucun')).toBeTruthy()
|
||||
expect(screen.queryByRole('textbox', { name: 'Citation' })).toBeNull()
|
||||
expect(screen.queryByRole('button', { name: 'Modifier' })).toBeNull()
|
||||
expect(screen.queryByRole('button', { name: 'Supprimer' })).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user