1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

fix tests missing selection, unskip some tests

This commit is contained in:
Ian Storm Taylor
2019-12-13 12:53:58 -05:00
parent d8b915a406
commit bb6a4d9ce8
15 changed files with 23 additions and 25 deletions

View File

@@ -10,6 +10,7 @@ describe('slate-history', () => {
run(editor)
editor.exec({ type: 'undo' })
assert.deepEqual(editor.children, output.children)
assert.deepEqual(editor.selection, output.selection)
})
})

View File

@@ -4,7 +4,7 @@ import { Editor } from 'slate'
import { jsx } from '../..'
export const run = editor => {
editor.delete()
Editor.delete(editor)
}
export const input = (
@@ -18,5 +18,3 @@ export const input = (
)
export const output = input
export const skip = true

View File

@@ -4,7 +4,7 @@ import { Editor } from 'slate'
import { jsx } from '../..'
export const run = editor => {
editor.delete()
Editor.delete(editor)
}
export const input = (
@@ -21,5 +21,3 @@ export const input = (
)
export const output = input
export const skip = true

View File

@@ -4,7 +4,7 @@ import { Editor } from 'slate'
import { jsx } from '../..'
export const run = editor => {
editor.delete()
Editor.delete(editor)
}
export const input = (
@@ -29,5 +29,3 @@ export const input = (
)
export const output = input
export const skip = true

View File

@@ -38,5 +38,3 @@ export const input = (
)
export const output = input
export const skip = true

View File

@@ -1,12 +1,13 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../..'
export const run = editor => {
editor.exec({ type: 'insert_text', text: 't' })
// editor.move({ reverse: true })
Editor.move(editor, { reverse: true })
editor.exec({ type: 'insert_text', text: 'w' })
// editor.move({ reverse: true })
Editor.move(editor, { reverse: true })
editor.exec({ type: 'insert_text', text: 'o' })
}

View File

@@ -313,6 +313,8 @@ export const GeneralTransforms = {
editor.selection = isDraft(selection)
? (finishDraft(selection) as Range)
: selection
} else {
editor.selection = null
}
},
}

View File

@@ -28,7 +28,6 @@ export const NodeTransforms = {
} = {}
) {
Editor.withoutNormalizing(editor, () => {
const { selection } = editor
const { hanging = false, voids = false } = options
let { at, match, select } = options

View File

@@ -21,6 +21,7 @@ describe('slate', () => {
})
assert.deepEqual(editor.children, output.children)
assert.deepEqual(editor.selection, output.selection)
})
fixtures(__dirname, 'normalization', ({ module }) => {
@@ -28,6 +29,7 @@ describe('slate', () => {
const editor = withTest(input)
Editor.normalize(editor, { force: true })
assert.deepEqual(editor.children, output.children)
assert.deepEqual(editor.selection, output.selection)
})
fixtures(__dirname, 'queries', ({ module }) => {
@@ -42,6 +44,7 @@ describe('slate', () => {
const editor = withTest(input)
run(editor)
assert.deepEqual(editor.children, output.children)
assert.deepEqual(editor.selection, output.selection)
})
})

View File

@@ -41,5 +41,3 @@ export const output = (
</block>
</editor>
)
export const skip = true

View File

@@ -22,8 +22,9 @@ export const run = editor => {
export const output = (
<editor>
<block void>
onetwo
one
<cursor />
two
</block>
</editor>
)

View File

@@ -28,8 +28,9 @@ export const output = (
<block>
one
<inline void>
twofour
two
<cursor />
four
</inline>
three
</block>

View File

@@ -20,7 +20,6 @@ export const input = (
</editor>
)
// TODO: the hanging selection here isn't right
export const output = (
<editor>
<block>

View File

@@ -24,8 +24,9 @@ export const output = (
<block>
one
<inline>two</inline>
fourthree
four
<cursor />
three
</block>
</editor>
)

View File

@@ -21,15 +21,15 @@ export const input = (
</editor>
)
// TODO: the selection is wrong here
export const output = (
<editor>
<block>one</block>
<block>
<cursor />
<text />
</block>
<block>
<cursor />
three
</block>
<block>three</block>
</editor>
)
export const skip = true