mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-11 09:43:58 +02:00
add on-select behavior test
This commit is contained in:
15
test/behavior/fixtures/on-select/move-selection/index.js
Normal file
15
test/behavior/fixtures/on-select/move-selection/index.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
import Simulate from '../../../../helpers/simulate'
|
||||||
|
import { Selection } from '../../../../..'
|
||||||
|
|
||||||
|
export default function (state, stack) {
|
||||||
|
const selection = Selection.create({
|
||||||
|
anchorKey: 'c',
|
||||||
|
anchorOffset: 1,
|
||||||
|
focusKey: 'c',
|
||||||
|
focusOffset: 1,
|
||||||
|
isFocused: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
return Simulate.select(stack, state, null, { selection })
|
||||||
|
}
|
17
test/behavior/fixtures/on-select/move-selection/input.yaml
Normal file
17
test/behavior/fixtures/on-select/move-selection/input.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
document:
|
||||||
|
key: a
|
||||||
|
nodes:
|
||||||
|
- key: b
|
||||||
|
kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- key: c
|
||||||
|
kind: text
|
||||||
|
text: word
|
||||||
|
selection:
|
||||||
|
anchorKey: c
|
||||||
|
anchorOffset: 0
|
||||||
|
focusKey: c
|
||||||
|
focusOffset: 0
|
||||||
|
isFocused: true
|
17
test/behavior/fixtures/on-select/move-selection/output.yaml
Normal file
17
test/behavior/fixtures/on-select/move-selection/output.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
document:
|
||||||
|
key: a
|
||||||
|
nodes:
|
||||||
|
- key: b
|
||||||
|
kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- key: c
|
||||||
|
kind: text
|
||||||
|
text: word
|
||||||
|
selection:
|
||||||
|
anchorKey: c
|
||||||
|
anchorOffset: 1
|
||||||
|
focusKey: c
|
||||||
|
focusOffset: 1
|
||||||
|
isFocused: true
|
Reference in New Issue
Block a user