1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-07-31 20:40:19 +02:00

add more schema tests

This commit is contained in:
Ian Storm Taylor
2019-12-03 15:32:09 -05:00
parent 62af4cb053
commit 687f25df4b
14 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const schema = [
{
for: 'node',
match: { a: true },
validate: {
children: [{ match: [{ b: true }, { c: true }] }],
},
},
]
export const input = (
<editor>
<element a>
<element b>one</element>
<element d>two</element>
</element>
</editor>
)
export const output = (
<editor>
<element a>
<element b>one</element>
</element>
</editor>
)

View File

@@ -0,0 +1,24 @@
/** @jsx jsx */
import { jsx } from 'slate-hyperscript'
export const schema = [
{
for: 'node',
match: { a: true },
validate: {
children: [{ match: [{ b: true }, { c: true }] }],
},
},
]
export const input = (
<editor>
<element a>
<element b>one</element>
<element c>two</element>
</element>
</editor>
)
export const output = input