From 550a17cf2661411861e54f0ebbe07f9a1a28fc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Thu, 3 Nov 2016 18:46:00 +0100 Subject: [PATCH] Add failing test for undo of joinNode --- .../on-history/undo/join-node-block/index.js | 18 ++++++++++++++++++ .../on-history/undo/join-node-block/input.yaml | 14 ++++++++++++++ .../undo/join-node-block/output.yaml | 14 ++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 test/transforms/fixtures/on-history/undo/join-node-block/index.js create mode 100644 test/transforms/fixtures/on-history/undo/join-node-block/input.yaml create mode 100644 test/transforms/fixtures/on-history/undo/join-node-block/output.yaml diff --git a/test/transforms/fixtures/on-history/undo/join-node-block/index.js b/test/transforms/fixtures/on-history/undo/join-node-block/index.js new file mode 100644 index 000000000..02c7d5d7b --- /dev/null +++ b/test/transforms/fixtures/on-history/undo/join-node-block/index.js @@ -0,0 +1,18 @@ + +import assert from 'assert' + +export default function (state) { + const { selection } = state + + const next = state + .transform() + .joinNodeByKey('key2', 'key1') + .apply() + + .transform() + .undo() + .apply() + + assert.deepEqual(next.selection.toJS(), selection.toJS()) + return next +} diff --git a/test/transforms/fixtures/on-history/undo/join-node-block/input.yaml b/test/transforms/fixtures/on-history/undo/join-node-block/input.yaml new file mode 100644 index 000000000..b33e60815 --- /dev/null +++ b/test/transforms/fixtures/on-history/undo/join-node-block/input.yaml @@ -0,0 +1,14 @@ + +nodes: + - kind: block + key: 'key1' + type: paragraph + nodes: + - kind: text + text: The + - kind: block + key: 'key2' + type: paragraph + nodes: + - kind: text + text: text diff --git a/test/transforms/fixtures/on-history/undo/join-node-block/output.yaml b/test/transforms/fixtures/on-history/undo/join-node-block/output.yaml new file mode 100644 index 000000000..b33e60815 --- /dev/null +++ b/test/transforms/fixtures/on-history/undo/join-node-block/output.yaml @@ -0,0 +1,14 @@ + +nodes: + - kind: block + key: 'key1' + type: paragraph + nodes: + - kind: text + text: The + - kind: block + key: 'key2' + type: paragraph + nodes: + - kind: text + text: text