mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-10 01:06:37 +02:00
Adapt tests for setBlock/setInline with isVoid
This commit is contained in:
@@ -3,8 +3,7 @@ import assert from 'assert'
|
|||||||
|
|
||||||
export default function (state) {
|
export default function (state) {
|
||||||
const { document, selection } = state
|
const { document, selection } = state
|
||||||
const texts = document.getTexts()
|
let first = document.getTexts().first()
|
||||||
const first = texts.first()
|
|
||||||
const range = selection.merge({
|
const range = selection.merge({
|
||||||
anchorKey: first.key,
|
anchorKey: first.key,
|
||||||
anchorOffset: 0,
|
anchorOffset: 0,
|
||||||
@@ -21,9 +20,16 @@ export default function (state) {
|
|||||||
})
|
})
|
||||||
.apply()
|
.apply()
|
||||||
|
|
||||||
|
// Selection is reset, in theory it should me on the image
|
||||||
|
first = next.document.getTexts().first()
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
next.selection.toJS(),
|
next.selection.toJS(),
|
||||||
range.toJS()
|
range.merge({
|
||||||
|
anchorKey: first.key,
|
||||||
|
anchorOffset: 0,
|
||||||
|
focusKey: first.key,
|
||||||
|
focusOffset: 0
|
||||||
|
}).toJS()
|
||||||
)
|
)
|
||||||
|
|
||||||
return next
|
return next
|
||||||
|
@@ -4,7 +4,7 @@ import assert from 'assert'
|
|||||||
export default function (state) {
|
export default function (state) {
|
||||||
const { document, selection } = state
|
const { document, selection } = state
|
||||||
const texts = document.getTexts()
|
const texts = document.getTexts()
|
||||||
const first = texts.first()
|
let first = texts.first()
|
||||||
const range = selection.merge({
|
const range = selection.merge({
|
||||||
anchorKey: first.key,
|
anchorKey: first.key,
|
||||||
anchorOffset: 0,
|
anchorOffset: 0,
|
||||||
@@ -21,10 +21,17 @@ export default function (state) {
|
|||||||
})
|
})
|
||||||
.apply()
|
.apply()
|
||||||
|
|
||||||
assert.deepEqual(
|
// Selection is reset, in theory it should me on the emoji
|
||||||
next.selection.toJS(),
|
first = next.document.getTexts().first()
|
||||||
range.toJS()
|
assert.deepEqual(
|
||||||
)
|
next.selection.toJS(),
|
||||||
|
range.merge({
|
||||||
|
anchorKey: first.key,
|
||||||
|
anchorOffset: 0,
|
||||||
|
focusKey: first.key,
|
||||||
|
focusOffset: 0
|
||||||
|
}).toJS()
|
||||||
|
)
|
||||||
|
|
||||||
return next
|
return next
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user