How to use the prosemirror-test-builder.ul 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-view / test / test-clipboard.js View on Github external
it("includes context for text selections", () => {
    let d = doc(blockquote(ul(li(p("fo<a>o"), p("b<b>ar")))))
    let view = tempEditor({doc: d})
    let slice = TextSelection.create(d, d.tag.a, d.tag.b).content(), {dom, text} = serializeForClipboard(view, slice)
    ist(dom.innerHTML, '<li data-pm-slice="2 2 [&quot;blockquote&quot;,null,&quot;bullet_list&quot;,null]"><p>o</p><p>b</p></li>')
    ist(parseFromClipboard(view, text, dom.innerHTML, false, d.resolve(1)), d.slice(d.tag.a, d.tag.b, true), eq)
    ist(parseFromClipboard(view, text, dom.innerHTML, true, d.resolve(1)), new Slice(doc(p("o"), p("b")).content, 1, 1), eq)
  })
</b></a>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("preserves openEnd when top isn't placed", () =&gt;
       repl(doc(ul(li(p("ab<a>cd")), li(p("ef<b>gh")))),
            doc(ul(li(p("ABCD")), li(p("EFGH")))).slice(5, 13, true),
            doc(ul(li(p("abCD")), li(p("EFgh"))))))
</b></a>
github ProseMirror / prosemirror-state / test / test-selection.js View on Github external
it("allows deleting a selected block", () => {
    let state = new TestState({doc: doc(p("foo"), ul(li(p("bar")), li(p("baz")), li(p("quux")))), schema})
    state.nodeSel(0)
    state.deleteSelection()
    ist(state.doc, doc(ul(li(p("bar")), li(p("baz")), li(p("quux")))), eq)
    ist(state.selection.head, 3)
    state.nodeSel(2)
    state.deleteSelection()
    ist(state.doc, doc(ul(li(p("baz")), li(p("quux")))), eq)
    ist(state.selection.head, 3)
    state.nodeSel(9)
    state.deleteSelection()
    ist(state.doc, doc(ul(li(p("baz")))), eq)
    ist(state.selection.head, 6)
    state.nodeSel(0)
    state.deleteSelection()
    ist(state.doc, doc(p()), eq)
  })
github ProseMirror / prosemirror-commands / test / test-commands.js View on Github external
it("joins lists when lifting a list between them", () =&gt;
     apply(doc(ul(li(p("a"))), blockquote("<a>", ul(li(p("b")))), ul(li(p("c")))),
           autoJoin(lift, ["bullet_list"]),
           doc(ul(li(p("a")), li(p("b")), li(p("c"))))))
})</a>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("deletes empty parent nodes", () =&gt;
       del(doc(blockquote(ul(li("<a>", p("foo"), "<b>")), p("x"))),
           doc(blockquote("</b></a><b><a><b>", p("x")))))
</b></a></b>
github ProseMirror / prosemirror-model / test / test-slice.js View on Github external
it("can cut across different depths", () =&gt;
       t(doc(ul(li(p("hello")), li(p("wo<a>rld")), li(p("x"))), p(em("bo<b>o"))),
         doc(ul(li(p("rld")), li(p("x"))), p(em("bo"))), 3, 1))
</b></a>
github ProseMirror / prosemirror-view / test / test-clipboard.js View on Github external
it("will sanely clean up top-level nodes in HTML", () =&gt; {
    let view = tempEditor(), $p = view.state.doc.resolve(1)
    ist(parseFromClipboard(view, "", "<ul><li>foo</li></ul>bar<br>", false, $p),
        new Slice(doc(ul(li(p("foo"))), p("bar", br)).content, 3, 1), eq)
    ist(parseFromClipboard(view, "", "<ul><li>foo</li></ul>bar<br><p>x</p>", false, $p),
        new Slice(doc(ul(li(p("foo"))), p("bar", br), p("x")).content, 3, 1), eq)
    ist(parseFromClipboard(view, "", "<li>foo</li><li>bar</li><p>x</p>", false, $p),
        new Slice(doc(ol(li(p("foo")), li(p("bar"))), p("x")).content, 3, 1), eq)
  })
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("will join multiple levels when possible", () =&gt;
       repl(doc(blockquote(ul(li(p("a")), li(p("b<a>")), li(p("c")), li(p("<b>d")), li(p("e"))))),
            null,
            doc(blockquote(ul(li(p("a")), li(p("b</b></a><b><a><b>d")), li(p("e")))))))
</b></a></b>
github ProseMirror / prosemirror-view / test / test-view.js View on Github external
it("can be queried for the DOM position at a doc position", () => {
    let view = tempEditor({doc: doc(ul(li(p(strong("foo")))))})
    let inText = view.domAtPos(4)
    ist(inText.offset, 1)
    ist(inText.node.nodeValue, "foo")
    let beforeLI = view.domAtPos(1)
    ist(beforeLI.offset, 0)
    ist(beforeLI.node.nodeName, "UL")
    let afterP = view.domAtPos(7)
    ist(afterP.offset, 1)
    ist(afterP.node.nodeName, "LI")
  })
github ProseMirror / prosemirror-view / test / test-selection.js View on Github external
it("makes arrow motion go through selectable block nodes", () =&gt; {
    let view = tempEditor({doc: doc(p("hello<a>"), hr, ul(li(p("there"))))})
    view.dispatchEvent(event(DOWN))
    ist(view.state.selection.from, 7)
    setSel(view, 11)
    view.dispatchEvent(event(UP))
    ist(view.state.selection.from, 7)
  })
</a>