How to use the prosemirror-test-builder.schema.text function in prosemirror-test-builder

To help you get started, we’ve selected a few prosemirror-test-builder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ProseMirror / prosemirror-history / test / test-history.js View on Github external
it("combines appended transactions in the event started by the base transaction", () => {
    let state = mkState(doc(p("x")), {plugins: [new Plugin({
      appendTransaction: (_trs, _old, state) => {
        if (state.doc.content.size == 4) return state.tr.insert(1, schema.text("A"))
      }
    })]})
    state = state.apply(state.tr.insert(2, schema.text("I")))
    ist(state.doc, doc(p("AxI")), eq)
    ist(undoDepth(state), 1)
    state = command(state, undo)
    ist(state.doc, doc(p("x")), eq)
  })
github ProseMirror / prosemirror-model / test / test-node.js View on Github external
it("joins adjacent text", () =>
       from([schema.text("a"), schema.text("b")], p("ab")))
  })
github ProseMirror / prosemirror-state / test / test-selection.js View on Github external
it("allows typing over a leaf node", () => {
    let state = new TestState({doc: doc(p("a"), "<a>", hr, p("b")), schema})
    state.nodeSel(3)
    state.apply(state.tr.replaceSelectionWith(schema.text("x")))
    ist(state.doc, doc(p("a"), p("x"), p("b")), eq)
    ist(state.selection.head, 5)
    ist(state.selection.anchor, 5)
  })
</a>
github ProseMirror / prosemirror-view / test / test-decoration.js View on Github external
it("respects the side option on widgets", () => {
      let d = doc(p("foo"))
      let set = build(d, {pos: 3, side: -1, name: "a"}, {pos: 3, name: "b"})
      let tr = new Transform(d).replaceWith(3, 3, schema.text("ay"))
      let result = set.map(tr.mapping, tr.doc).find().map(d => d.from + "-" + d.spec.name).sort().join(", ")
      ist(result, "3-a, 5-b")
    })
github ProseMirror / prosemirror-history / test / test-history.js View on Github external
it("properly maps selection when rebasing", () => {
    let state = mkState(doc(p("123456789ABCD")))
    state = state.apply(state.tr.setSelection(TextSelection.create(state.doc, 6, 13)))
    state = state.apply(state.tr.delete(6, 13))
    let rebase = state.tr.insert(6, schema.text("6789ABC")).insert(14, schema.text("E")).delete(6, 13)
        .setMeta("rebased", 1).setMeta("addToHistory", false)
    rebase.mapping.setMirror(0, 2)
    state = state.apply(rebase)
    state = command(state, undo)
  })
})
github ProseMirror / prosemirror-history / test / test-history.js View on Github external
appendTransaction: (_trs, _old, state) => {
        if (state.doc.content.size == 4) return state.tr.insert(1, schema.text("A"))
      }
    })]})
github ProseMirror / prosemirror-view / test / test-decoration.js View on Github external
                           tr => tr.replaceWith(2, 2, schema.text(".")).replaceWith(4, 4, schema.text("?")))
      ist(str(set), "[0: [2-3]]")
github ProseMirror / prosemirror-changeset / test / test-changed-range.js View on Github external
let {doc0, set0, set, tr} = mk(doc(p("abcd")), tr => tr
                                   .replaceWith(2, 2, schema.text("c"))
                                   .delete(3, 5))
    let set1 = ChangeSet.create(doc0).addSteps(tr.docs[1], [tr.mapping.maps[0]], ["a"])