How to use the prosemirror-test-builder.doc 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-transform / test / test-trans.js View on Github external
it("works after another step", () => {
      let d = doc(p("foobar"), p("baz<a>"))
      let tr = new Transform(d).delete(d.tag.x, d.tag.y), pos = tr.mapping.map(d.tag.a)
      tr.setBlockType(pos, pos, schema.nodes.heading, {level: 1})
      testTransform(tr, doc(p("far"), h1("baz</a><a>")))
    })
</a>
github ProseMirror / prosemirror-model / test / test-diff.js View on Github external
it("spots different text", () =&gt;
       end(doc(p("foob<a>ar")),
           doc(p("foocar"))))
</a>
github ProseMirror / prosemirror-model / test / test-content.js View on Github external
it("completes a plus across two bounds", () =>
       fill3("paragraph{4}", doc(p()), doc(p()), doc(p()), doc(), doc(p())))
github ProseMirror / prosemirror-model / test / test-diff.js View on Github external
it("notices when one node is longer", () =&gt;
       start(doc(p("a", em("b")), p("hello"), blockquote(h1("bye")), "<a>"),
             doc(p("a", em("b")), p("hello"), blockquote(h1("bye")), p("oops"))))
</a>
github ProseMirror / prosemirror-view / test / test-decoration.js View on Github external
it("rebuilds subtrees correctly at an offset", () => {
      let d = doc(p("foobar"), ul(li(p("abc")), li(p("b"))))
      let set = build(d, {pos: 18})
      let tr = new Transform(d).join(16)
      ist(set.map(tr.mapping, tr.doc).find().map(d => d.from).join(), "16")
    })
github ProseMirror / prosemirror-model / test / test-diff.js View on Github external
it("returns null when there is no difference", () =>
       end(doc(p("a", em("b")), p("hello"), blockquote(h1("bye"))),
           doc(p("a", em("b")), p("hello"), blockquote(h1("bye")))))
github ProseMirror / prosemirror-state / test / test-selection.js View on Github external
it("allows typing over a leaf node", () =&gt; {
    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-endOfTextblock.js View on Github external
it("works after a widget", () =&gt; {
    let d = doc(p("fo<a>o")), w = document.createElement("span")
    w.textContent = "!"
    let view = tempEditor({doc: d, decorations() {
      return DecorationSet.create(d, [Decoration.widget(3, w)])
    }})
    ist(!view.endOfTextblock("backward"))
  })
})</a>
github ProseMirror / prosemirror-changeset / test / test-diff.js View on Github external
it("ignores attributes", () =>
     test(doc(h1("x")), doc(h2("x"))))
github ProseMirror / prosemirror-model / test / test-replace.js View on Github external
it("keeps the node type even when empty", () =&gt;
       rpl(doc(h1("<a>bar"), "<b>"),
           doc(p("foo</b></a><b><a>baz"), "<b>"),
           doc(h1("baz"))))
</b></a></b>