feat(editor): edit mode of the references dialog

« Modifier » turns the references dialog into a draft of adds and removes,
saved as one update on the current citations. A new layer, citations,
guards it between the finding and the reference dialogs: close, Back,
POP refusal and the leave cascade ask it. « Modifier la référence » and
« Nouvelle référence » stack the reference dialog over it; a creation it
started joins its draft.
This commit is contained in:
bchanot committed 2026-11-15 16:39:43 +01:00
1 parent d9dbcf1609
commit 3dc5820e3a
29 files changed
+1489 -243

No files matched your search

@@ -46,6 +46,7 @@ function Editor() {
return (
<>
<Layer guards={nav.guards} layer="finding" />
<Layer guards={nav.guards} layer="citations" />
<Layer guards={nav.guards} layer="reference" />
</>
)
@@ -93,23 +94,28 @@ const layer = (name: LayerName) => screen.queryByTestId(name)
const button = (name: LayerName, label: string) =>
within(layer(name)!).getByRole('button', { name: label })
describe('a reference dialog over a finding dialog, both dirty', () => {
it('asks the reference, then the finding, then the jump goes', async () => {
describe('reference, citations and finding dialogs, all dirty', () => {
it('asks the reference, the citations, then the finding, then the jump goes', async () => {
const user = userEvent.setup()
expect(jump().defaultPrevented).toBe(true)
expect(within(layer('finding')!).queryByRole('group')).toBeNull()
expect(within(layer('citations')!).queryByRole('group')).toBeNull()
await user.click(button('reference', 'Abandonner'))
expect(layer('reference')).toBeNull()
expect(within(layer('finding')!).queryByRole('group')).toBeNull()
await user.click(button('citations', 'Abandonner'))
expect(layer('citations')).toBeNull()
expect(api.traverseTo).not.toHaveBeenCalled()
await user.click(button('finding', 'Abandonner'))
expect(api.traverseTo).toHaveBeenCalledTimes(1)
expect(api.traverseTo).toHaveBeenCalledWith('list')
})
it('« Continuer la saisie » on the second keeps the finding, no jump', async () => {
it('« Continuer la saisie » on the last keeps the finding, no jump', async () => {
const user = userEvent.setup()
jump()
await user.click(button('reference', 'Abandonner'))
await user.click(button('citations', 'Abandonner'))
await user.click(button('finding', 'Continuer la saisie'))
expect(layer('finding')).not.toBeNull()
expect(within(layer('finding')!).queryByRole('group')).toBeNull()
@@ -121,6 +127,7 @@ describe('a reference dialog over a finding dialog, both dirty', () => {
jump()
await user.click(button('reference', 'Continuer la saisie'))
expect(layer('reference')).not.toBeNull()
expect(layer('citations')).not.toBeNull()
expect(layer('finding')).not.toBeNull()
expect(api.traverseTo).not.toHaveBeenCalled()
})