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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user