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:
1 parent
d9dbcf1609
commit
3dc5820e3a
29 files changed
+1489
-243
No files matched your search
@@ -0,0 +1,29 @@
|
||||
/** Rev 5 Task 12: the citations draft, held as additions and removals. */
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
addId,
|
||||
applyEdits,
|
||||
NO_EDITS,
|
||||
removeId,
|
||||
} from '@/editor/references/citationEdits'
|
||||
|
||||
describe('citation edits', () => {
|
||||
it('applies removals and additions to the current list, each id once', () => {
|
||||
const edits = addId(removeId(NO_EDITS, 'a'), 'b')
|
||||
expect(applyEdits(['a', 'c'], edits)).toEqual(['c', 'b'])
|
||||
expect(applyEdits(['a', 'b'], edits)).toEqual(['b'])
|
||||
expect(applyEdits([], edits)).toEqual(['b'])
|
||||
})
|
||||
|
||||
it('a removal then a citation of the same id is no change at all', () => {
|
||||
expect(addId(removeId(NO_EDITS, 'a'), 'a')).toEqual(NO_EDITS)
|
||||
expect(removeId(addId(NO_EDITS, 'n'), 'n')).toEqual(NO_EDITS)
|
||||
})
|
||||
|
||||
it('a repeat is ignored', () => {
|
||||
const once = addId(NO_EDITS, 'b')
|
||||
expect(addId(once, 'b')).toBe(once)
|
||||
const gone = removeId(NO_EDITS, 'a')
|
||||
expect(removeId(gone, 'a')).toBe(gone)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user