How to use the prosemirror-test-builder.h1 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("can change a wrapped block", () =>
       type(doc(blockquote(p("one<a>"), p("two<b>"))),
            doc(blockquote(h1("one</b></a><b><a>"), h1("two<b>"))),
            "heading", {level: 1}))
</b></a></b>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("can insert while joining textblocks", () =&gt;
       repl(doc(h1("he<a>llo"), p("arg<b>!")),
            doc(p("1</b></a><b><a>2<b>3")),
            doc(h1("he2!"))))
</b></a></b>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("can replace a node when endpoints are in different children", () =&gt;
       repl(doc(p("a"), ul(li(p("<a>b")), li(p("c"), blockquote(p("d<b>")))), p("e")),
            doc(h1("</b></a><b><a>x<b>")),
            doc(p("a"), h1("x"), p("e"))))
</b></a></b>
github ProseMirror / prosemirror-commands / test / test-commands.js View on Github external
it("splits off a normal paragraph when splitting at the start of a textblock", () =&gt;
     apply(doc(h1("<a>foo")), splitBlock, doc(p(), h1("foo"))))
</a>
github ProseMirror / prosemirror-changeset / test / test-changes.js View on Github external
find(doc(p("abcd"), p("efgh")), tr => tr.delete(2, 10).insert(2, t("cdef")),
          [[2, 3, 2, 2], [5, 7, 4, 4], [9, 10, 6, 6]]))

  it("handles re-adding content step by step", find(doc(p("one two three")), [
    tr => tr.delete(1, 14),
    tr => tr.insert(1, t("two")),
    tr => tr.insert(4, t(" ")),
    tr => tr.insert(5, t("three"))
  ], [[1, 5, 1, 1]]))

  it("doesn't get confused by split deletions", find(doc(blockquote(h1("one"), p("two four"))), [
    tr => tr.delete(7, 11),
    tr => tr.replaceWith(0, 13, blockquote(h1("one"), p("four")))
  ], [[7, 11, 7, 7, [[4, 0]], []]], true))

  it("doesn't get confused by multiply split deletions", find(doc(blockquote(h1("one"), p("two three"))), [
    tr => tr.delete(14, 16),
    tr => tr.delete(7, 11),
    tr => tr.delete(3, 5),
    tr => tr.replaceWith(0, 10, blockquote(h1("o"), p("thr")))
  ], [[3, 5, 3, 3, [[2, 2]], []], [8, 12, 6, 6, [[3, 1], [1, 3]], []],
      [14, 16, 8, 8, [[2, 0]], []]], true))

  it("won't lose the order of overlapping changes", find(doc(p("12345")), [
    tr => tr.delete(4, 5),
    tr => tr.replaceWith(2, 2, t("a")),
    tr => tr.delete(1, 6),
    tr => tr.replaceWith(1, 1, t("1a235"))
  ], [[2, 2, 2, 3, [], [[1, 1]]], [4, 5, 5, 5, [[1, 0]], []]], [0, 0, 1, 1]))

  it("properly maps deleted positions", find(doc(p("jTKqvPrzApX")), [
    tr => tr.delete(8, 11),
github ProseMirror / prosemirror-commands / test / test-commands.js View on Github external
it("splits a heading in two when in the middle", () =&gt;
     apply(doc(h1("foo<a>bar")), splitBlock, doc(h1("foo"), h1("bar"))))
</a>
github ProseMirror / prosemirror-model / test / test-diff.js View on Github external
it("works when the difference is at the start", () =&gt;
       start(doc("<a>", p("b")),
             doc(h1("b"))))
</a>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("respects the type param", () =&gt;
       split(doc(h1("hell<a>o!")),
             doc(h1("hell"), p("</a><a>o!")),
             undefined, [{type: schema.nodes.paragraph}]))
</a>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("respects the type param", () =&gt;
       split(doc(h1("hell<a>o!")),
             doc(h1("hell"), p("</a><a>o!")),
             undefined, [{type: schema.nodes.paragraph}]))
</a>