fix(editor): Task 12 review minors, delete hint and cite label

This commit is contained in:
bchanot committed 2026-11-15 16:58:50 +01:00
1 parent 8c420d4b53
commit 11c2b0c5ee
12 files changed
+113 -47

No files matched your search

@@ -182,10 +182,13 @@ const removeRow = (user: User, citation: RegExp) =>
}),
)
const cite = (user: User, id: string) =>
user.selectOptions(inCitations().getByLabelText('Citer une référence'), id)
user.selectOptions(
inCitations().getByLabelText('Citer une référence existante'),
id,
)
describe('the « Modifier » of the references dialog', () => {
it('switches to the edit mode: no history entry, no « Tout afficher », no « Aller à »', async () => {
it('edit mode: no history entry, no « Tout afficher », no « Aller à »', async () => {
const user = await mount()
await openCitations(user)
const before = written()!.id
@@ -243,6 +246,17 @@ describe('the draft', () => {
expect(inCitations().queryByText('Modifications enregistrées')).toBeNull()
})
it('the draft list is named; an empty draft shows no list', async () => {
const user = await mount(1280, sheetText([]))
await editCitations(user, '0 référence')
expect(inCitations().queryByRole('list')).toBeNull()
expect(inCitations().getByText('Aucune référence citée.')).toBeVisible()
await cite(user, 'ref-b')
expect(
inCitations().getByRole('list', { name: 'Références citées' }),
).toBeVisible()
})
it('a dangling id is named and removable', async () => {
const user = await mount(1280, sheetText(['ref-a', 'ref-x']))
await editCitations(user)
@@ -252,7 +266,7 @@ describe('the draft', () => {
expect(nodeA().reference_ids).toEqual(['ref-a'])
})
it('a save keeps citations changed elsewhere: removals and additions on the current list', async () => {
it('a save applies the draft to the current list (changes made elsewhere stay)', async () => {
const user = await mount()
await editCitations(user)
await removeRow(user, /Barone/)
@@ -331,7 +345,9 @@ describe('leaving the edit mode with changes', () => {
expect(button(/^Retirer/)).toBeDisabled()
expect(button(/^Modifier la référence/)).toBeDisabled()
expect(button('Nouvelle référence')).toBeDisabled()
expect(inCitations().queryByLabelText('Citer une référence')).toBeNull()
expect(
inCitations().queryByLabelText('Citer une référence existante'),
).toBeNull()
expect(inCitations().queryByRole('button', { name: 'Annuler' })).toBeNull()
await user.click(button('Abandonner'))
await waitFor(() =>
@@ -512,7 +528,7 @@ describe('a reference over the references dialog of a dirty finding (criterion 2
await user.type(inReference().getByLabelText('Citation'), ' x')
}
it('the finding asks next with the references dialog closed, focused; the jump goes after it', async () => {
it('the finding asks next, references dialog closed, focused; then the jump goes', async () => {
const user = await mount()
await stacked(user)
expect(jump().defaultPrevented).toBe(true)
@@ -543,7 +559,7 @@ describe('a reference over the references dialog of a dirty finding (criterion 2
expect(api.traverseTo).not.toHaveBeenCalled()
})
it('a citations draft under a clean reference dialog asks once the reference is closed', async () => {
it('a citations draft under a clean reference dialog asks once it is closed', async () => {
const user = await mount()
await editCitations(user)
await removeRow(user, /Code rural/)