1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

add testes

This commit is contained in:
Ian Storm Taylor
2019-12-13 12:32:53 -05:00
parent c20f771b0a
commit d8b915a406
9 changed files with 235 additions and 6 deletions

View File

@@ -0,0 +1,23 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../..'
export const input = (
<editor>
<block a>
<block a>one</block>
</block>
</editor>
)
export const run = editor => {
return Editor.match(editor, [0, 0, 0], { a: true })
}
export const output = [
<block a>
<block a>one</block>
</block>,
[0],
]

View File

@@ -0,0 +1,23 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../..'
export const input = (
<editor>
<block a b c>
one
</block>
</editor>
)
export const run = editor => {
return Editor.match(editor, [0, 0], { a: true })
}
export const output = [
<block a b c>
one
</block>,
[0],
]

View File

@@ -0,0 +1,16 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../..'
export const input = (
<editor>
<block a>one</block>
</editor>
)
export const run = editor => {
return Editor.match(editor, [0, 0], { a: true })
}
export const output = [<block a>one</block>, [0]]

View File

@@ -0,0 +1,23 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../..'
export const input = (
<editor>
<block a>
one<inline>two</inline>three
</block>
</editor>
)
export const run = editor => {
return Editor.match(editor, [0, 1, 0], { a: true })
}
export const output = [
<block a>
one<inline>two</inline>three
</block>,
[0],
]

View File

@@ -0,0 +1,23 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../..'
export const input = (
<editor>
<block a b c>
one
</block>
</editor>
)
export const run = editor => {
return Editor.match(editor, [0, 0], { a: true, b: true })
}
export const output = [
<block a b c>
one
</block>,
[0],
]

View File

@@ -0,0 +1,33 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../..'
export const input = (
<editor>
<block>
one
<cursor />
</block>
</editor>
)
export const run = editor => {
Editor.insertNodes(
editor,
<block void>
<text>two</text>
</block>,
{ at: [1], select: true }
)
}
export const output = (
<editor>
<block>one</block>
<block void>
two
<cursor />
</block>
</editor>
)

View File

@@ -0,0 +1,38 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../..'
export const input = (
<editor>
<block>
one
<cursor />
</block>
</editor>
)
export const run = editor => {
Editor.insertNodes(
editor,
<block void>
<block>
<text>two</text>
</block>
</block>
)
}
export const output = (
<editor>
<block>one</block>
<block void>
<block>
<text>
two
<cursor />
</text>
</block>
</block>
</editor>
)

View File

@@ -1,23 +1,32 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../..'
export const run = editor => {
Editor.deselect(editor)
}
import { jsx } from '../../..'
export const input = (
<editor>
<block>
<cursor focused={false} />
one
<cursor />
</block>
</editor>
)
export const run = editor => {
Editor.insertNodes(
editor,
<block void>
<text>two</text>
</block>
)
}
export const output = (
<editor>
<block>one</block>
<block void>
two
<cursor />
</block>
</editor>
)

View File

@@ -0,0 +1,41 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../..'
export const input = (
<editor>
<block>
one
<inline>
two
<cursor />
</inline>
three
</block>
</editor>
)
export const run = editor => {
Editor.insertNodes(
editor,
<inline void>
<text>four</text>
</inline>
)
}
export const output = (
<editor>
<block>
one
<inline>two</inline>
<text />
<inline void>
four
<cursor />
</inline>
three
</block>
</editor>
)