1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-20 15:14:38 +01:00

Test undo add/remove mark

This commit is contained in:
Soreine 2016-11-09 13:17:35 +01:00
parent 6bfaf0872c
commit c7294be7d5
6 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,18 @@
import assert from 'assert'
export default function (state) {
const { selection } = state
const next = state
.transform()
.addMarkByKey('key1', 0, 8, 'marktype')
.apply()
.transform()
.undo()
.apply()
assert.deepEqual(next.selection.toJS(), selection.toJS())
return next
}

View File

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

View File

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

View File

@ -0,0 +1,18 @@
import assert from 'assert'
export default function (state) {
const { selection } = state
const next = state
.transform()
.removeMarkByKey('key1', 0, 8, 'mark')
.apply()
.transform()
.undo()
.apply()
assert.deepEqual(next.selection.toJS(), selection.toJS())
return next
}

View File

@ -0,0 +1,11 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
key: 'key1'
ranges:
- text: The text
marks:
- type: 'mark'

View File

@ -0,0 +1,11 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
key: 'key1'
ranges:
- text: The text
marks:
- type: 'mark'