mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-21 07:32:58 +01:00
Split adfToPlainText's step, node and emit helpers out of its writer
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
|
||||
import type { AdfDocument, AdfMark, AdfNode } from '../adf/document.ts'
|
||||
import type { AdfAttributes, AdfDocument, AdfMark, AdfNode } from '../adf/document.ts'
|
||||
import type { Result } from '../result.ts'
|
||||
import { adfToHtml, adfToPlainText } from '../index.ts'
|
||||
import { largestNesting } from '../nesting.ts'
|
||||
@@ -319,7 +319,7 @@ test('writes the images of a group and an inline image on the line they stand in
|
||||
})
|
||||
|
||||
test('writes a card as its address, or as its name then its address', () => {
|
||||
const card = (attrs: Record<string, unknown>): AdfNode => ({ attrs, type: 'blockCard' })
|
||||
const card = (attrs: AdfAttributes): AdfNode => ({ attrs, type: 'blockCard' })
|
||||
assert.equal(shown(card({ url: 'https://example.com/spec' })), 'Before\n\nhttps://example.com/spec\n\nAfter')
|
||||
assert.equal(shown(card({ data: { name: 'Design spec' }, url: 'https://example.com/spec' })), 'Before\n\nhttps://example.com/spec\n\nAfter')
|
||||
assert.equal(shown(card({ data: { name: 'Design spec' } })), 'Before\n\nDesign spec\n\nAfter')
|
||||
|
||||
Reference in New Issue
Block a user