3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-21 15:42:58 +01:00

Keep the one-fallback-per-pass loop in the properties, out of the writers' signatures

This commit is contained in:
2026-10-30 21:47:06 +01:00
committed by Lillem4n
parent 87e6f6102d
commit d28bb4a13f
6 changed files with 111 additions and 63 deletions
@@ -412,11 +412,11 @@ test('gives up every highlight run whose own delimiter cannot flank in one fallb
const highlight: AdfMark = { type: 'backgroundColor' }
const line = [text('a '), text('x', highlight), text('a '), text('x', highlight), text('a '), text('x', highlight), text('a')]
const runs = [{ depth: 0, first: 1, last: 1 }, { depth: 0, first: 3, last: 3 }, { depth: 0, first: 5, last: 5 }]
assert.deepEqual(portableLineFallback(line, 'paragraph', [], () => false), { ok: true, value: { kind: 'unspellable-run', runs } })
assert.deepEqual(portableLineFallback(line, 'paragraph', []), { ok: true, value: { kind: 'unspellable-run', runs } })
})
test('refuses a portable line holding a node only the carry spells, at the line', () => {
const refused = portableLineFallback([text('x', { type: 'odd' })], 'paragraph', ['content', 0], () => false)
const refused = portableLineFallback([text('x', { type: 'odd' })], 'paragraph', ['content', 0])
assert.deepEqual(refused.ok ? refused : [refused.error.code, refused.error.path], ['unsupported-node-shape', ['content', 0]])
})