mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-19 06:18:16 +01:00
add more schema tests
add more schema tests
This commit is contained in:
parent
8982ba9b2f
commit
624c03339b
@ -0,0 +1,32 @@
|
||||
/** @jsx jsx */
|
||||
|
||||
import { jsx } from 'slate-hyperscript'
|
||||
|
||||
export const schema = [
|
||||
{
|
||||
for: 'node',
|
||||
match: { a: true },
|
||||
validate: {
|
||||
children: [{ match: { b: true } }],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
export const input = (
|
||||
<editor>
|
||||
<element a>
|
||||
<element b>one</element>
|
||||
<element c>two</element>
|
||||
<element c>three</element>
|
||||
<element c>four</element>
|
||||
</element>
|
||||
</editor>
|
||||
)
|
||||
|
||||
export const output = (
|
||||
<editor>
|
||||
<element a>
|
||||
<element b>one</element>
|
||||
</element>
|
||||
</editor>
|
||||
)
|
@ -0,0 +1,30 @@
|
||||
/** @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 b>two</element>
|
||||
</element>
|
||||
</editor>
|
||||
)
|
||||
|
||||
export const output = (
|
||||
<editor>
|
||||
<element a>
|
||||
<text />
|
||||
</element>
|
||||
</editor>
|
||||
)
|
@ -40,7 +40,7 @@ export const GeneralTransforms = {
|
||||
}
|
||||
|
||||
Editor.withoutNormalizing(editor, () => {
|
||||
const max = getDirtyPaths(editor).length * 42 // HACK: better way to do editor?
|
||||
const max = getDirtyPaths(editor).length * 42 // HACK: better way?
|
||||
let m = 0
|
||||
|
||||
while (getDirtyPaths(editor).length !== 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user