How to use the prosemirror-test-builder.li 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("does not violate schema constraints", () =>
     apply(doc(ul(li(p("<a>foo"), blockquote(p("bar"))))), liftEmptyBlock, null))
</a>
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-commands / test / test-commands.js View on Github external
it("doesn't join lists when deleting an item inside of them", () =&gt;
     apply(doc(ul(li(p("a")), "<a>", li(p("b"))), ul(li(p("c")))),
           autoJoin(deleteSelection, ["bullet_list"]),
           doc(ul(li(p("a"))), ul(li(p("c"))))))
</a>
github ProseMirror / prosemirror-state / test / test-selection.js View on Github external
it("puts the cursor after the inserted text when inserting a list item", () =&gt; {
    let state = new TestState({doc: doc(p("<a>abc"))})
    let source = doc(ul(li(p("</a><a>def<b>"))))
    state.apply(state.tr.replaceSelection(source.slice(source.tag.a, source.tag.b, true)))
    ist(state.selection.from, 6)
  })
})</b></a>
github ProseMirror / prosemirror-model / test / test-dom.js View on Github external
it("ignores meaningless whitespace",
       recover(" <blockquote> <p>woo  \n  <em> hooo</em></p> </blockquote> ",
               doc(blockquote(p("woo ", em("hooo"))))))

    it("removes whitespace after a hard break",
       recover("<p>hello<br>\n  world</p>",
               doc(p("hello", br, "world"))))

    it("converts br nodes to newlines when they would otherwise be ignored",
       recover("<pre>foo<br>bar</pre>",
               doc(pre("foo\nbar"))))

    it("finds a valid place for invalid content",
       recover("<ul><li>hi</li><p>whoah</p><li>again</li></ul>",
               doc(ul(li(p("hi")), li(p("whoah")), li(p("again"))))))

    it("moves nodes up when they don't fit the current context",
       recover("<div>hello<hr>bye</div>",
               doc(p("hello"), hr, p("bye"))))

    it("doesn't ignore whitespace-only text nodes",
       recover("<p><em>one</em> <strong>two</strong></p>",
               doc(p(em("one"), " ", strong("two")))))

    it("can handle stray tab characters",
       recover("<p> <b>	</b></p>",
               doc(p())))

    it("normalizes random spaces",
       recover("<p><b>1 </b>  </p>",
               doc(p(strong("1")))))
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("will close open nodes to the right", () =&gt;
       repl(doc(p("x"), "<a>"),
            doc("</a><a>", ul(li(p("a")), li("<b>", p("b")))),
            doc(p("x"), ul(li(p("a")), li(p())), "</b></a><b><a>")))
</a></b>
github ProseMirror / prosemirror-commands / test / test-commands.js View on Github external
it("acts on multiple blocks when possible", () =&gt;
     apply(doc(p("a<a>bc"), p("def"), ul(li(p("ghi"), p("jk<b>l")))), setCode,
           doc(pre("a</b></a><b><a>bc"), pre("def"), ul(li(p("ghi"), pre("jk<b>l"))))))
</b></a></b>
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-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)
  })