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:
parent
6bfaf0872c
commit
c7294be7d5
18
test/transforms/fixtures/on-history/undo/add-mark/index.js
Normal file
18
test/transforms/fixtures/on-history/undo/add-mark/index.js
Normal 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
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
|
||||
nodes:
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
key: 'key1'
|
||||
text: The text
|
@ -0,0 +1,8 @@
|
||||
|
||||
nodes:
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
key: 'key1'
|
||||
text: The text
|
@ -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
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
|
||||
nodes:
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
key: 'key1'
|
||||
ranges:
|
||||
- text: The text
|
||||
marks:
|
||||
- type: 'mark'
|
@ -0,0 +1,11 @@
|
||||
|
||||
nodes:
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
key: 'key1'
|
||||
ranges:
|
||||
- text: The text
|
||||
marks:
|
||||
- type: 'mark'
|
Loading…
x
Reference in New Issue
Block a user