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:
@@ -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
|
||||
}
|
@@ -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
|
@@ -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
|
Reference in New Issue
Block a user