mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-19 14:45:44 +01:00
Keep an empty doc content in editor-normal ADF, as the schema requires
This commit is contained in:
@@ -50,14 +50,15 @@ test('reads negative zero as zero, as JSON does', () => {
|
||||
)
|
||||
})
|
||||
|
||||
test('reads an empty attrs object, marks array or content array as the absent key', () => {
|
||||
test('reads an empty attrs object, marks array or content array as the absent key, but on doc', () => {
|
||||
const paragraph: AdfNode = { attrs: {}, content: [{ attrs: {}, marks: [], text: 'a', type: 'text' }, { marks: [{ attrs: {}, type: 'em' }], text: 'b', type: 'text' }], marks: [], type: 'paragraph' }
|
||||
assert.deepEqual(toEditorNormal({ content: [paragraph, { content: [], type: 'rule' }], type: 'doc', version: 1 }), {
|
||||
content: [{ content: [{ text: 'a', type: 'text' }, { marks: [{ type: 'em' }], text: 'b', type: 'text' }], type: 'paragraph' }, { type: 'rule' }],
|
||||
type: 'doc',
|
||||
version: 1,
|
||||
})
|
||||
assert.deepEqual(toEditorNormal({ content: [], type: 'doc', version: 1 }), { type: 'doc', version: 1 })
|
||||
assert.deepEqual(toEditorNormal({ content: [], type: 'doc', version: 1 }), { content: [], type: 'doc', version: 1 })
|
||||
assert.deepEqual(toEditorNormal({ type: 'doc', version: 1 }), { type: 'doc', version: 1 })
|
||||
})
|
||||
|
||||
test('normalizes blocks and mark attributes nesting far past the levels a recursive walk survives', () => {
|
||||
|
||||
Reference in New Issue
Block a user