From ff5e67e63f113e0f519a2cf4e97484c14a158e29 Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Tue, 29 Nov 2016 16:21:18 -0800 Subject: [PATCH] add test for joining forward on inline voids --- .../join-blocks-with-inline-void/index.js | 17 +++++++++++++++++ .../join-blocks-with-inline-void/input.yaml | 17 +++++++++++++++++ .../join-blocks-with-inline-void/output.yaml | 12 ++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/index.js create mode 100644 test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/input.yaml create mode 100644 test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/output.yaml diff --git a/test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/index.js b/test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/index.js new file mode 100644 index 000000000..5cfc23e3c --- /dev/null +++ b/test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/index.js @@ -0,0 +1,17 @@ + +export default function (state) { + const { document, selection } = state + const texts = document.getTexts() + const first = texts.first() + const range = selection.merge({ + anchorKey: first.key, + anchorOffset: first.length, + focusKey: first.key, + focusOffset: first.length + }) + + return state + .transform() + .deleteForwardAtRange(range) + .apply() +} diff --git a/test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/input.yaml b/test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/input.yaml new file mode 100644 index 000000000..db568574a --- /dev/null +++ b/test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/input.yaml @@ -0,0 +1,17 @@ + +nodes: + - kind: block + type: paragraph + nodes: + - kind: text + text: "" + - kind: block + type: paragraph + nodes: + - kind: text + text: "" + - kind: inline + type: emoji + isVoid: true + - kind: text + text: "" diff --git a/test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/output.yaml b/test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/output.yaml new file mode 100644 index 000000000..057979d81 --- /dev/null +++ b/test/transforms/fixtures/at-range/delete-forward-at-range/join-blocks-with-inline-void/output.yaml @@ -0,0 +1,12 @@ + +nodes: + - kind: block + type: paragraph + nodes: + - kind: text + text: "" + - kind: inline + type: emoji + isVoid: true + - kind: text + text: ""