diff --git a/test/transforms/fixtures/wrap-inline/twice/index.js b/test/transforms/fixtures/wrap-inline/twice/index.js new file mode 100644 index 000000000..c66ea2e1c --- /dev/null +++ b/test/transforms/fixtures/wrap-inline/twice/index.js @@ -0,0 +1,23 @@ + +import assert from 'assert' + +export default function (state) { + const { document, selection } = state + const texts = document.getTexts() + const text = texts.first() + const range = selection.merge({ + anchorKey: text.key, + anchorOffset: 7, + focusKey: text.key, + focusOffset: 11 + }) + + const next = state + .transform() + .moveTo(range) + .wrapInline('inner') + .wrapInline('outer') + .apply() + + return next +} diff --git a/test/transforms/fixtures/wrap-inline/twice/input.yaml b/test/transforms/fixtures/wrap-inline/twice/input.yaml new file mode 100644 index 000000000..34c5c02d8 --- /dev/null +++ b/test/transforms/fixtures/wrap-inline/twice/input.yaml @@ -0,0 +1,7 @@ + +nodes: + - kind: block + type: paragraph + nodes: + - kind: text + text: before word after diff --git a/test/transforms/fixtures/wrap-inline/twice/output.yaml b/test/transforms/fixtures/wrap-inline/twice/output.yaml new file mode 100644 index 000000000..27fedbbd5 --- /dev/null +++ b/test/transforms/fixtures/wrap-inline/twice/output.yaml @@ -0,0 +1,16 @@ +nodes: + - kind: block + type: paragraph + nodes: + - kind: text + text: "before " + - kind: inline + type: outer + nodes: + - kind: inline + type: inner + nodes: + - kind: text + text: word + - kind: text + text: " after"