1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-22 15:02:51 +02:00

Add another test for undo

This commit is contained in:
Soreine
2016-11-17 10:07:57 +01:00
parent e868d44af4
commit fbf014cc48
3 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import assert from 'assert'
export default function (state) {
const { selection } = state
const range = selection.merge({
anchorKey: 'key1',
anchorOffset: 1,
focusKey: 'key2',
focusOffset: 3
})
const next = state
.transform()
.deleteAtRange(range)
.apply()
.transform()
.undo()
.apply()
assert.deepEqual(next.selection.toJS(), selection.toJS())
return next
}

View File

@@ -0,0 +1,14 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
key: 'key1'
text: The
- kind: block
type: paragraph
nodes:
- kind: text
key: 'key2'
text: text

View File

@@ -0,0 +1,14 @@
nodes:
- kind: block
key: 'key1'
type: paragraph
nodes:
- kind: text
text: The
- kind: block
key: 'key2'
type: paragraph
nodes:
- kind: text
text: text