diff --git a/packages/slate-history/test/index.js b/packages/slate-history/test/index.js
index 45717b908..4c17e289d 100644
--- a/packages/slate-history/test/index.js
+++ b/packages/slate-history/test/index.js
@@ -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)
})
})
diff --git a/packages/slate-history/test/undo/delete_backward/block-text.js b/packages/slate-history/test/undo/delete_backward/block-text.js
index 40fa14980..d013e551a 100644
--- a/packages/slate-history/test/undo/delete_backward/block-text.js
+++ b/packages/slate-history/test/undo/delete_backward/block-text.js
@@ -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
diff --git a/packages/slate-history/test/undo/delete_backward/custom-prop.js b/packages/slate-history/test/undo/delete_backward/custom-prop.js
index 1bd874053..50f288d35 100644
--- a/packages/slate-history/test/undo/delete_backward/custom-prop.js
+++ b/packages/slate-history/test/undo/delete_backward/custom-prop.js
@@ -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
diff --git a/packages/slate-history/test/undo/delete_backward/inline-across.js b/packages/slate-history/test/undo/delete_backward/inline-across.js
index 4720ebcfd..2c25193d3 100644
--- a/packages/slate-history/test/undo/delete_backward/inline-across.js
+++ b/packages/slate-history/test/undo/delete_backward/inline-across.js
@@ -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
diff --git a/packages/slate-history/test/undo/insert_fragment/basic.js b/packages/slate-history/test/undo/insert_fragment/basic.js
index 8195d753c..41c1e59cf 100644
--- a/packages/slate-history/test/undo/insert_fragment/basic.js
+++ b/packages/slate-history/test/undo/insert_fragment/basic.js
@@ -38,5 +38,3 @@ export const input = (
)
export const output = input
-
-export const skip = true
diff --git a/packages/slate-history/test/undo/insert_text/non-contiguous.js b/packages/slate-history/test/undo/insert_text/non-contiguous.js
index 0dc54ea76..f4af5cbf8 100644
--- a/packages/slate-history/test/undo/insert_text/non-contiguous.js
+++ b/packages/slate-history/test/undo/insert_text/non-contiguous.js
@@ -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' })
}
diff --git a/packages/slate/src/interfaces/editor/transforms/general.ts b/packages/slate/src/interfaces/editor/transforms/general.ts
index 3f8af20ba..feccc14eb 100755
--- a/packages/slate/src/interfaces/editor/transforms/general.ts
+++ b/packages/slate/src/interfaces/editor/transforms/general.ts
@@ -313,6 +313,8 @@ export const GeneralTransforms = {
editor.selection = isDraft(selection)
? (finishDraft(selection) as Range)
: selection
+ } else {
+ editor.selection = null
}
},
}
diff --git a/packages/slate/src/interfaces/editor/transforms/node.ts b/packages/slate/src/interfaces/editor/transforms/node.ts
index 55f97bb91..786ab07d9 100644
--- a/packages/slate/src/interfaces/editor/transforms/node.ts
+++ b/packages/slate/src/interfaces/editor/transforms/node.ts
@@ -28,7 +28,6 @@ export const NodeTransforms = {
} = {}
) {
Editor.withoutNormalizing(editor, () => {
- const { selection } = editor
const { hanging = false, voids = false } = options
let { at, match, select } = options
diff --git a/packages/slate/test/index.js b/packages/slate/test/index.js
index c4f116e07..39abf4cb1 100644
--- a/packages/slate/test/index.js
+++ b/packages/slate/test/index.js
@@ -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)
})
})
diff --git a/packages/slate/test/transforms/insertNodes/block/inline-void.js b/packages/slate/test/transforms/insertNodes/block/inline-void.js
index 09a0b4b76..e556228a8 100644
--- a/packages/slate/test/transforms/insertNodes/block/inline-void.js
+++ b/packages/slate/test/transforms/insertNodes/block/inline-void.js
@@ -41,5 +41,3 @@ export const output = (
)
-
-export const skip = true
diff --git a/packages/slate/test/transforms/insertNodes/voids-true/block.js b/packages/slate/test/transforms/insertNodes/voids-true/block.js
index d2840ea11..ab79bccb4 100644
--- a/packages/slate/test/transforms/insertNodes/voids-true/block.js
+++ b/packages/slate/test/transforms/insertNodes/voids-true/block.js
@@ -22,8 +22,9 @@ export const run = editor => {
export const output = (
- onetwo
+ one
+ two
)
diff --git a/packages/slate/test/transforms/insertNodes/voids-true/inline.js b/packages/slate/test/transforms/insertNodes/voids-true/inline.js
index 3a9a922dc..d67362fc1 100644
--- a/packages/slate/test/transforms/insertNodes/voids-true/inline.js
+++ b/packages/slate/test/transforms/insertNodes/voids-true/inline.js
@@ -28,8 +28,9 @@ export const output = (
one
- twofour
+ two
+ four
three
diff --git a/packages/slate/test/transforms/insertText/selection/block-hanging.js b/packages/slate/test/transforms/insertText/selection/block-hanging.js
index 345f5e793..17d116e3a 100644
--- a/packages/slate/test/transforms/insertText/selection/block-hanging.js
+++ b/packages/slate/test/transforms/insertText/selection/block-hanging.js
@@ -20,7 +20,6 @@ export const input = (
)
-// TODO: the hanging selection here isn't right
export const output = (
diff --git a/packages/slate/test/transforms/insertText/selection/inline-end.js b/packages/slate/test/transforms/insertText/selection/inline-end.js
index 64e65638c..b229afba5 100644
--- a/packages/slate/test/transforms/insertText/selection/inline-end.js
+++ b/packages/slate/test/transforms/insertText/selection/inline-end.js
@@ -24,8 +24,9 @@ export const output = (
one
two
- fourthree
+ four
+ three
)
diff --git a/packages/slate/test/transforms/splitNodes/selection/block-hanging.js b/packages/slate/test/transforms/splitNodes/selection/block-hanging.js
index 7b1067343..5791788ca 100644
--- a/packages/slate/test/transforms/splitNodes/selection/block-hanging.js
+++ b/packages/slate/test/transforms/splitNodes/selection/block-hanging.js
@@ -21,15 +21,15 @@ export const input = (
)
-// TODO: the selection is wrong here
export const output = (
one
-
+
+
+
+
+ three
- three
)
-
-export const skip = true