mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-21 14:41:23 +02:00
add more schema tests
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
/** @jsx jsx */
|
||||||
|
|
||||||
|
import { jsx } from 'slate-hyperscript'
|
||||||
|
|
||||||
|
export const schema = [
|
||||||
|
{
|
||||||
|
for: 'node',
|
||||||
|
match: { a: true },
|
||||||
|
validate: {
|
||||||
|
children: [{ match: 'text', max: 1 }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export const input = (
|
||||||
|
<editor>
|
||||||
|
<element a>
|
||||||
|
<element b>one</element>
|
||||||
|
</element>
|
||||||
|
</editor>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const output = (
|
||||||
|
<editor>
|
||||||
|
<element a>
|
||||||
|
<text />
|
||||||
|
</element>
|
||||||
|
</editor>
|
||||||
|
)
|
@@ -0,0 +1,27 @@
|
|||||||
|
/** @jsx jsx */
|
||||||
|
|
||||||
|
import { jsx } from 'slate-hyperscript'
|
||||||
|
|
||||||
|
export const schema = [
|
||||||
|
{
|
||||||
|
for: 'node',
|
||||||
|
match: { a: true },
|
||||||
|
validate: {
|
||||||
|
children: [
|
||||||
|
{ match: { b: true }, min: 1, max: 1 },
|
||||||
|
{ match: { c: true }, min: 0 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export const input = (
|
||||||
|
<editor>
|
||||||
|
<element a>
|
||||||
|
<element b>one</element>
|
||||||
|
<element c>two</element>
|
||||||
|
</element>
|
||||||
|
</editor>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const output = input
|
@@ -0,0 +1,26 @@
|
|||||||
|
/** @jsx jsx */
|
||||||
|
|
||||||
|
import { jsx } from 'slate-hyperscript'
|
||||||
|
|
||||||
|
export const schema = [
|
||||||
|
{
|
||||||
|
for: 'node',
|
||||||
|
match: { a: true },
|
||||||
|
validate: {
|
||||||
|
children: [
|
||||||
|
{ match: { b: true }, min: 1, max: 1 },
|
||||||
|
{ match: { c: true }, min: 0 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export const input = (
|
||||||
|
<editor>
|
||||||
|
<element a>
|
||||||
|
<element b>one</element>
|
||||||
|
</element>
|
||||||
|
</editor>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const output = input
|
Reference in New Issue
Block a user