mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-03 04:02:33 +02:00
add raw serializer tests
This commit is contained in:
@@ -37,6 +37,18 @@ class Text extends new Record(DEFAULTS) {
|
|||||||
return new Text(properties)
|
return new Text(properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a list of `Texts` from an array.
|
||||||
|
*
|
||||||
|
* @param {Array} elements
|
||||||
|
* @return {List} map
|
||||||
|
*/
|
||||||
|
|
||||||
|
static createList(elements = []) {
|
||||||
|
if (List.isList(elements)) return elements
|
||||||
|
return new List(elements.map(Text.create))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the node's kind.
|
* Get the node's kind.
|
||||||
*
|
*
|
||||||
|
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: quote
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- type: quote
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- type: paragraph
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- characters:
|
||||||
|
- text: o
|
||||||
|
marks: []
|
||||||
|
- text: n
|
||||||
|
marks: []
|
||||||
|
- text: e
|
||||||
|
marks: []
|
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
data:
|
||||||
|
key: value
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- type: paragraph
|
||||||
|
isVoid: false
|
||||||
|
data:
|
||||||
|
key: value
|
||||||
|
nodes:
|
||||||
|
- characters:
|
||||||
|
- text: o
|
||||||
|
marks: []
|
||||||
|
- text: n
|
||||||
|
marks: []
|
||||||
|
- text: e
|
||||||
|
marks: []
|
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
isVoid: true
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- type: paragraph
|
||||||
|
isVoid: true
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- characters: []
|
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
13
test/serializers/fixtures/raw/deserialize/block/output.yaml
Normal file
13
test/serializers/fixtures/raw/deserialize/block/output.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- type: paragraph
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- characters:
|
||||||
|
- text: o
|
||||||
|
marks: []
|
||||||
|
- text: n
|
||||||
|
marks: []
|
||||||
|
- text: e
|
||||||
|
marks: []
|
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: link
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: hashtag
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- type: paragraph
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- type: link
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- type: hashtag
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- characters:
|
||||||
|
- text: o
|
||||||
|
marks: []
|
||||||
|
- text: n
|
||||||
|
marks: []
|
||||||
|
- text: e
|
||||||
|
marks: []
|
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: link
|
||||||
|
data:
|
||||||
|
key: value
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- type: paragraph
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- type: link
|
||||||
|
isVoid: false
|
||||||
|
data:
|
||||||
|
key: value
|
||||||
|
nodes:
|
||||||
|
- characters:
|
||||||
|
- text: o
|
||||||
|
marks: []
|
||||||
|
- text: n
|
||||||
|
marks: []
|
||||||
|
- text: e
|
||||||
|
marks: []
|
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: link
|
||||||
|
isVoid: true
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- type: paragraph
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- type: link
|
||||||
|
isVoid: true
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- characters: []
|
11
test/serializers/fixtures/raw/deserialize/inline/input.yaml
Normal file
11
test/serializers/fixtures/raw/deserialize/inline/input.yaml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: link
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
17
test/serializers/fixtures/raw/deserialize/inline/output.yaml
Normal file
17
test/serializers/fixtures/raw/deserialize/inline/output.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- type: paragraph
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- type: link
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- characters:
|
||||||
|
- text: o
|
||||||
|
marks: []
|
||||||
|
- text: n
|
||||||
|
marks: []
|
||||||
|
- text: e
|
||||||
|
marks: []
|
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: o
|
||||||
|
- text: n
|
||||||
|
marks:
|
||||||
|
- type: bold
|
||||||
|
- text: e
|
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- type: paragraph
|
||||||
|
isVoid: false
|
||||||
|
data: {}
|
||||||
|
nodes:
|
||||||
|
- characters:
|
||||||
|
- text: o
|
||||||
|
marks: []
|
||||||
|
- text: n
|
||||||
|
marks:
|
||||||
|
- type: bold
|
||||||
|
data: {}
|
||||||
|
- text: e
|
||||||
|
marks: []
|
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
import { Block, Character, Document, Inline, Mark, State, Text } from '../../../../../..'
|
||||||
|
|
||||||
|
export default State.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'quote',
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
nodes: Text.createList([
|
||||||
|
{
|
||||||
|
characters: Character.createList([
|
||||||
|
{ text: 'o' },
|
||||||
|
{ text: 'n' },
|
||||||
|
{ text: 'e' }
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: quote
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
import { Block, Character, Document, Inline, Mark, State, Text } from '../../../../../..'
|
||||||
|
|
||||||
|
export default State.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
data: { key: 'value' },
|
||||||
|
nodes: Text.createList([
|
||||||
|
{
|
||||||
|
characters: Character.createList([
|
||||||
|
{ text: 'o' },
|
||||||
|
{ text: 'n' },
|
||||||
|
{ text: 'e' }
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
data:
|
||||||
|
key: value
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
import { Block, Character, Document, Inline, Mark, State, Text } from '../../../../../..'
|
||||||
|
|
||||||
|
export default State.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
isVoid: true,
|
||||||
|
nodes: Text.createList([
|
||||||
|
{
|
||||||
|
characters: Character.createList([
|
||||||
|
{ text: 'o' },
|
||||||
|
{ text: 'n' },
|
||||||
|
{ text: 'e' }
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
isVoid: true
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: ""
|
21
test/serializers/fixtures/raw/serialize/block/input.js
Normal file
21
test/serializers/fixtures/raw/serialize/block/input.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
import { Block, Character, Document, Inline, Mark, State, Text } from '../../../../../..'
|
||||||
|
|
||||||
|
export default State.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
nodes: Text.createList([
|
||||||
|
{
|
||||||
|
characters: Character.createList([
|
||||||
|
{ text: 'o' },
|
||||||
|
{ text: 'n' },
|
||||||
|
{ text: 'e' }
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
import { Block, Character, Document, Inline, Mark, State, Text } from '../../../../../..'
|
||||||
|
|
||||||
|
export default State.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
nodes: Text.createList([
|
||||||
|
{
|
||||||
|
characters: Character.createList([
|
||||||
|
{ text: 'o' },
|
||||||
|
{ text: 'n' },
|
||||||
|
{
|
||||||
|
text: 'e',
|
||||||
|
marks: Mark.createSet([
|
||||||
|
{
|
||||||
|
type: 'bold'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: "on"
|
||||||
|
- text: e
|
||||||
|
marks:
|
||||||
|
- type: bold
|
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
import { Block, Character, Document, Inline, Mark, State, Text } from '../../../../../..'
|
||||||
|
|
||||||
|
export default State.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
nodes: Inline.createList([
|
||||||
|
{
|
||||||
|
type: 'link',
|
||||||
|
nodes: Inline.createList([
|
||||||
|
{
|
||||||
|
type: 'hashtag',
|
||||||
|
nodes: Text.createList([
|
||||||
|
{
|
||||||
|
characters: Character.createList([
|
||||||
|
{ text: 'o' },
|
||||||
|
{ text: 'n' },
|
||||||
|
{ text: 'e' }
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: link
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: hashtag
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
import { Block, Character, Document, Inline, Mark, State, Text } from '../../../../../..'
|
||||||
|
|
||||||
|
export default State.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
nodes: Inline.createList([
|
||||||
|
{
|
||||||
|
type: 'link',
|
||||||
|
data: { key: 'value' },
|
||||||
|
nodes: Text.createList([
|
||||||
|
{
|
||||||
|
characters: Character.createList([
|
||||||
|
{ text: 'o' },
|
||||||
|
{ text: 'n' },
|
||||||
|
{ text: 'e' }
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: link
|
||||||
|
data:
|
||||||
|
key: value
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
import { Block, Character, Document, Inline, Mark, State, Text } from '../../../../../..'
|
||||||
|
|
||||||
|
export default State.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
nodes: Inline.createList([
|
||||||
|
{
|
||||||
|
type: 'link',
|
||||||
|
isVoid: true,
|
||||||
|
nodes: Text.createList([
|
||||||
|
{
|
||||||
|
characters: Character.createList([
|
||||||
|
{ text: 'o' },
|
||||||
|
{ text: 'n' },
|
||||||
|
{ text: 'e' }
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: link
|
||||||
|
isVoid: true
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: ""
|
26
test/serializers/fixtures/raw/serialize/inline/input.js
Normal file
26
test/serializers/fixtures/raw/serialize/inline/input.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
import { Block, Character, Document, Inline, Mark, State, Text } from '../../../../../..'
|
||||||
|
|
||||||
|
export default State.create({
|
||||||
|
document: Document.create({
|
||||||
|
nodes: Block.createList([
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
nodes: Inline.createList([
|
||||||
|
{
|
||||||
|
type: 'link',
|
||||||
|
nodes: Text.createList([
|
||||||
|
{
|
||||||
|
characters: Character.createList([
|
||||||
|
{ text: 'o' },
|
||||||
|
{ text: 'n' },
|
||||||
|
{ text: 'e' }
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
})
|
11
test/serializers/fixtures/raw/serialize/inline/output.yaml
Normal file
11
test/serializers/fixtures/raw/serialize/inline/output.yaml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: inline
|
||||||
|
type: link
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
ranges:
|
||||||
|
- text: one
|
79
test/serializers/index.js
Normal file
79
test/serializers/index.js
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
import assert from 'assert'
|
||||||
|
import fs from 'fs'
|
||||||
|
import readMetadata from 'read-metadata'
|
||||||
|
import { Html, Plain, Raw } from '../..'
|
||||||
|
import { equal, strictEqual } from '../helpers/assert-json'
|
||||||
|
import { resolve } from 'path'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serializers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const SERIALIZERS = {
|
||||||
|
html: Html,
|
||||||
|
plain: Plain,
|
||||||
|
raw: Raw
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests.
|
||||||
|
*/
|
||||||
|
|
||||||
|
describe('serializers', () => {
|
||||||
|
const serializers = fs.readdirSync(resolve(__dirname, './fixtures'))
|
||||||
|
|
||||||
|
for (const serializer of serializers) {
|
||||||
|
describe(serializer, () => {
|
||||||
|
describe('deserialize()', () => {
|
||||||
|
const dir = resolve(__dirname, './fixtures', serializer, 'deserialize')
|
||||||
|
const tests = fs.readdirSync(dir)
|
||||||
|
|
||||||
|
for (const test of tests) {
|
||||||
|
it(test, () => {
|
||||||
|
const innerDir = resolve(dir, test)
|
||||||
|
const input = readMetadata.sync(resolve(innerDir, 'input.yaml'))
|
||||||
|
const expected = readMetadata.sync(resolve(innerDir, 'output.yaml'))
|
||||||
|
const Serializer = SERIALIZERS[serializer]
|
||||||
|
const state = Serializer.deserialize(input)
|
||||||
|
const json = state.document.toJS()
|
||||||
|
strictEqual(clean(json), expected)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('serialize()', () => {
|
||||||
|
const dir = resolve(__dirname, './fixtures', serializer, 'serialize')
|
||||||
|
const tests = fs.readdirSync(dir)
|
||||||
|
|
||||||
|
for (const test of tests) {
|
||||||
|
it(test, () => {
|
||||||
|
const innerDir = resolve(dir, test)
|
||||||
|
const input = require(resolve(innerDir, 'input.js')).default
|
||||||
|
const expected = readMetadata.sync(resolve(innerDir, 'output.yaml'))
|
||||||
|
const Serializer = SERIALIZERS[serializer]
|
||||||
|
const serialized = Serializer.serialize(input)
|
||||||
|
strictEqual(serialized, expected)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean a `json` object of dynamic `key` properties.
|
||||||
|
*
|
||||||
|
* @param {Object} json
|
||||||
|
* @return {Object}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function clean(json) {
|
||||||
|
const { key, cache, decorations, ...props } = json
|
||||||
|
|
||||||
|
if (props.nodes) {
|
||||||
|
props.nodes = props.nodes.map(clean)
|
||||||
|
}
|
||||||
|
|
||||||
|
return props
|
||||||
|
}
|
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
|
import './serializers'
|
||||||
import './rendering'
|
import './rendering'
|
||||||
import './transforms'
|
import './transforms'
|
||||||
|
Reference in New Issue
Block a user