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

Write the line feeds of consecutive code fragments as one text holds them

This commit is contained in:
2026-11-14 16:06:58 +01:00
committed by Lillem4n
parent d4a77ab207
commit 9080d09aac
2 changed files with 12 additions and 3 deletions
+6
View File
@@ -198,6 +198,12 @@ test('writes a code block ending in a line feed as one block, a blank line from
assert.equal(plain(adfToPlainText(document({ content: [text('a\n')], type: 'codeBlock' }, line('b')))), 'a\n\nb')
})
test('writes the line feeds of consecutive code fragments as the one fragment holding them all', () => {
const split: AdfNode = { content: [text('a\n'), text('\n'), text('b')], type: 'codeBlock' }
const whole: AdfNode = { content: [text('a\n\nb')], type: 'codeBlock' }
assert.equal(plain(adfToPlainText(document(split))), plain(adfToPlainText(document(whole))))
})
test('writes a task item holding blocks as an item', () => {
const tasks: AdfNode = { content: [{ attrs: { localId: 'a', state: 'TODO' }, content: [line('a'), line('b')], type: 'blockTaskItem' }], type: 'taskList' }
assert.equal(plain(adfToPlainText(document(tasks))), '☐ a\n b')