fix(editor): final review round, history, dialogs, Plus and limits

I1 scroll restored at once on a Back into layers; I2 Aller a opens the target dialog in one push; M1-M9, criteria 8 and 17 (left-draft notice), entry caps, no exhaustive-deps disables, locals within 5.
This commit is contained in:
bchanot committed 2026-11-13 23:42:32 +01:00
1 parent ce171427c0
commit 6bf9290da7
25 files changed
+1002 -202

No files matched your search

@@ -331,3 +331,57 @@ describe('the view the reducer holds', () => {
expect(state.visitedTabs).toEqual(['findings'])
})
})
describe('final review: « Aller à » is a move of its own (I-2)', () => {
it('pushes over the sheet it leaves, even with fewer layers on the same tab', () => {
const sheet = view('findings', { finding: { key: node, citations: true } })
const other: ElementKey = {
kind: 'finding',
zone_id: 'z',
path: ['f', 'm'],
}
const target = view('findings', {
finding: { key: other, citations: false },
})
const top = entry({ view: sheet, below: view('findings') })
expect(planWrite(top, target, false)).toBe('replace')
expect(planWrite(top, target, false, null, true)).toBe('push')
// An arrow-key replace still wins.
expect(planWrite(top, target, true, null, true)).toBe('replace')
})
})
describe('final review: read-back values are capped', () => {
const long = 'x'.repeat(129)
const atCap = 'x'.repeat(128)
const deep = (length: number): ElementKey => ({
kind: 'finding',
zone_id: 'z',
path: Array.from({ length }, (_, i) => `p${i}`),
})
const onFindings = (key: ElementKey) =>
view('findings', { finding: { key, citations: false } })
it('drops an entry whose id, sheet or account is over 128 characters', () => {
expect(readEntry(stateOf(entry({ id: atCap })))).not.toBeNull()
expect(readEntry(stateOf(entry({ id: long })))).toBeNull()
expect(readEntry(stateOf(entry({ sheetId: long })))).toBeNull()
expect(readEntry(stateOf(entry({ userId: long })))).toBeNull()
})
it('drops a key with an over-long id or a path deeper than the tree allows', () => {
const zone: ElementKey = { kind: 'zone', id: long }
expect(
readEntry(stateOf(entry({ view: onFindings(zone) })))?.view.finding,
).toBeNull()
const wideZone: ElementKey = { kind: 'finding', zone_id: long, path: ['a'] }
expect(sanitizeView(onFindings(wideZone))?.finding).toBeNull()
const wideId: ElementKey = { kind: 'finding', zone_id: 'z', path: [long] }
expect(sanitizeView(onFindings(wideId))?.finding).toBeNull()
expect(sanitizeView(onFindings(deep(8)))?.finding).not.toBeNull()
expect(sanitizeView(onFindings(deep(9)))?.finding).toBeNull()
const edit = { ...onFindings(node), reference: { edit: long } }
const sheet = { ...edit, finding: { key: node, citations: true } }
expect(sanitizeView(sheet)?.reference).toBeNull()
})
})