1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-20 06:01:24 +02:00

fix tests

This commit is contained in:
Ian Storm Taylor
2017-09-21 12:59:41 -07:00
parent a5f91ab7d4
commit 1320d56c4f
3 changed files with 15 additions and 14 deletions

View File

@@ -3,16 +3,17 @@
import h from '../../../helpers/h' import h from '../../../helpers/h'
export default function (change) { export default function (change) {
const key = '123' change.replaceNodeByKey('a', { kind: 'block', type: 'quote' })
const quote = { kind: 'block', type: 'quote' }
change.replaceNodeByKey(key, quote)
} }
export const input = ( export const input = (
<state> <state>
<document> <document>
<paragraph key="123"> <paragraph>
word one
</paragraph>
<paragraph key="a">
two
</paragraph> </paragraph>
</document> </document>
</state> </state>
@@ -21,6 +22,9 @@ export const input = (
export const output = ( export const output = (
<state> <state>
<document> <document>
<paragraph>
one
</paragraph>
<quote /> <quote />
</document> </document>
</state> </state>

View File

@@ -3,8 +3,7 @@
import h from '../../../helpers/h' import h from '../../../helpers/h'
export default function (change) { export default function (change) {
const quote = { kind: 'block', type: 'quote' } change.replaceNodeByKey('a', { kind: 'inline', type: 'emoji', isVoid: true })
change.replaceNodeByKey('a', quote)
} }
export const input = ( export const input = (
@@ -21,7 +20,7 @@ export const output = (
<state> <state>
<document> <document>
<paragraph> <paragraph>
one <quote /> one <emoji />
</paragraph> </paragraph>
</document> </document>
</state> </state>

View File

@@ -3,9 +3,7 @@
import h from '../../../helpers/h' import h from '../../../helpers/h'
export default function (change) { export default function (change) {
const key = change.state.document.getTexts().first().key change.replaceNodeByKey('a', { kind: 'text', ranges: [{ text: 'three' }] })
const text = { kind: 'text', text: 'three' }
change.replaceNodeByKey(key, text)
} }
export const input = ( export const input = (
@@ -15,7 +13,7 @@ export const input = (
one one
</paragraph> </paragraph>
<paragraph> <paragraph>
two <text key="a">one</text>
</paragraph> </paragraph>
</document> </document>
</state> </state>
@@ -25,10 +23,10 @@ export const output = (
<state> <state>
<document> <document>
<paragraph> <paragraph>
three one
</paragraph> </paragraph>
<paragraph> <paragraph>
two three
</paragraph> </paragraph>
</document> </document>
</state> </state>