How to use the prosemirror-test-builder.schema.marks 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-commands / test / test-commands.js View on Github external
it("preserves the stored marks", () => {
    let state = mkState(doc(p(em("foo<a>"))))
    toggleMark(schema.marks.strong)(state, tr =&gt; state = state.apply(tr))
    splitBlockKeepMarks(state, tr =&gt; state = state.apply(tr))
    ist(state.storedMarks.length, 2)
  })
})</a>
github ProseMirror / prosemirror-view / test / test-composition.js View on Github external
it("supports composition in a cursor wrapper", () =&gt; {
    let pm = requireFocus(tempEditor({doc: doc(p("<a>"))}))
    pm.dispatch(pm.state.tr.addStoredMark(schema.marks.em.create()))
    compose(pm, () =&gt; edit(pm.dom.firstChild.appendChild(document.createTextNode("")), "a"), [
      n =&gt; edit(n, "b"),
      n =&gt; edit(n, "c")
    ], {node: true})
    ist(pm.state.doc, doc(p(em("abc"))), eq)
  })
</a>
github ProseMirror / prosemirror-view / test / test-composition.js View on Github external
it("handles composition in a multi-child mark with a cursor wrapper", () =&gt; {
    let pm = requireFocus(tempEditor({doc: doc(p("one ", em("two<a>", strong(" three"))))}))
    pm.dispatch(pm.state.tr.addStoredMark(schema.marks.code.create()))
    let emNode = pm.dom.querySelector("em")
    compose(pm, () =&gt; edit(emNode.insertBefore(document.createTextNode(""), emNode.querySelector("strong")), "o"), [
      n =&gt; edit(n, "o"),
      n =&gt; edit(n, "w")
    ], {node: true})
    ist(pm.state.doc, doc(p("one ", em("two", code("oow"), strong(" three")))), eq)
  })
</a>
github ProseMirror / prosemirror-view / test / test-endOfTextblock.js View on Github external
it("works in a cursor wrapper", () =&gt; {
    let view = tempEditor({doc: doc(p("foo<a>"))})
    view.dispatch(view.state.tr.setStoredMarks([schema.marks.em.create()]))
    ist(!view.endOfTextblock("backward"))
  })
</a>
github ProseMirror / prosemirror-transform / test / test-step.js View on Github external
function mkStep(from, to, val) {
  if (val == "+em")
    return new AddMarkStep(from, to, schema.marks.em.create())
  else if (val == "-em")
    return new RemoveMarkStep(from, to, schema.marks.em.create())
  else
    return new ReplaceStep(from, to, val == null ? Slice.empty : new Slice(Fragment.from(schema.text(val)), 0, 0))
}