Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("can join lists", () =>
join(doc(ol(li(p("one")), li(p("two"))), "<a>", ol(li(p("three")))),
doc(ol(li(p("one")), li(p("two")), "</a><a>", li(p("three"))))))
</a>
it("doesn't split the parent block when at the start", () =>
apply(doc(ol("<a>", li(p("a")), li(p("b")), li(p("c")))), splitBlock, null))
</a>
it("can close nested parent nodes", () =>
repl(doc(blockquote(blockquote(p("one"), p("tw<a>o"), p("t<b>hree<3>"), p("four<4>")))),
doc(ol(li(p("hello</b></a><b><a>world")), li(p("bye"))), p("ne<b>xt")),
doc(blockquote(blockquote(p("one"), p("tw</b></a><b><a>world"), ol(li(p("bye"))), p("ne<b>hree<3>"), p("four<4>"))))))
</b></a></b></b>
it("can split a list item", () =>
split(doc(ol(li(p("one<1>")), li(p("two<a>three")), li(p("four<2>")))),
doc(ol(li(p("one<1>")), li(p("two")), li(p("</a><a>three")), li(p("four<2>")))),
2))
</a>
it("understands double slashes in context restrictions", () => {
ist(contextParser("blockquote//list_item/")
.parse(domFrom("<blockquote><ol><li><p>a</p></li></ol></blockquote>")),
doc(blockquote(ol(li(p("a"), hr)))), eq)
})
it("can wrap in a nested list", () =>
wrap(doc(ol(li(p("<1>one")), li(p("..."), p("<a>two"), p("<b>three")), li(p("<4>four")))),
doc(ol(li(p("<1>one")), li(p("..."), ol(li(p("</b></a><b><a>two"), p("<b>three")))), li(p("<4>four")))),
"ordered_list"))
</b></a></b>
it("understands pipes in context restrictions", () => {
ist(contextParser("list_item/|blockquote/")
.parse(domFrom("<blockquote><p></p></blockquote><ol><li><p>a</p></li></ol>")),
doc(blockquote(p(), hr), ol(li(p("a"), hr))), eq)
})
it("will match open list items", () =>
repl(doc(ol(li(p("one<a>")), li(p("three")))),
doc(ol(li(p("</a><a>half")), li(p("two")), "<b>")),
doc(ol(li(p("onehalf")), li(p("two")), li(p()), li(p("three"))))))
</b></a>
it("splits a parent block when a node is selected", () =>
apply(doc(ol(li(p("a")), "<a>", li(p("b")), li(p("c")))), splitBlock,
doc(ol(li(p("a"))), ol(li(p("b")), li(p("c"))))))
</a>