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 add a split one level up", () =>
rpl(doc(blockquote(p("foo<a>u"), p("v<b>bar"))),
doc(blockquote(p("</b></a><b><a>x")), blockquote(p("y<b>"))),
doc(blockquote(p("foox")), blockquote(p("ybar")))))
</b></a></b>
it("can serialize nested nodes", () => roundTrip(doc(blockquote(ul(li(p("a"), p("b")), li(p(img))), p("c")), p("d"))))
})
it("can lift from a nested node", () =>
lift(doc(blockquote(blockquote(p("<1>one"), p("<a>two"), p("<3>three"), p("<b>four"), p("<5>five")))),
doc(blockquote(blockquote(p("<1>one")), p("</b></a><b><a>two"), p("<3>three"), p("<b>four"), blockquote(p("<5>five"))))))
</b></a></b>
it("can cut between deeply nested nodes", () =>
t(doc(blockquote(p("foo<a>bar"), ul(li(p("a")), li(p("b"), "<b>", p("c"))), p("d"))),
blockquote(p("bar"), ul(li(p("a")), li(p("b")))), 1, 2))
</b></a>
it("correctly rebuilds a deep structure", () => {
let {oldSet, set} = buildMap(doc(blockquote(p("foo")), blockquote(blockquote(p("bar")))),
{from: 3, to: 4}, {from: 11, to: 12},
tr => tr.join(7))
ist(str(oldSet), "[0: [0: [1-2]], 7: [0: [0: [1-2]]]]")
ist(str(set), "[0: [0: [1-2], 5: [0: [1-2]]]]")
})
it("drops an empty node at the end of the slice", () =>
repl(doc(p("<a>x")),
doc(p("b</a><a>"), blockquote("<b>", p("hi"))),
doc(p(), blockquote(p()), p("x"))))
</b></a>
it("detects an enter press", () => {
let enterPressed = false
let view = tempEditor({
doc: doc(blockquote(p("foo"), p("<a>"))),
handleKeyDown: (_view, event) => { if (event.keyCode == 13) return enterPressed = true }
})
let bq = view.dom.querySelector("blockquote")
bq.appendChild(document.createElement("p"))
flush(view)
ist(enterPressed)
})
</a>
it("can move an inserted block backward out of parent nodes", () =>
repl(doc(p("a"), blockquote(p("<a>b"))), hr(), doc(p("a"), blockquote(hr, p("b")))))
})</a>
it("can cut between deeply nested nodes", () =>
t(doc(blockquote(p("foo<a>bar"), ul(li(p("a")), li(p("b"), "<b>", p("c"))), p("d"))),
blockquote(p("bar"), ul(li(p("a")), li(p("b")))), 1, 2))
</b></a>