Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("works after another step", () => {
let d = doc(p("foobar"), p("baz<a>"))
let tr = new Transform(d).delete(d.tag.x, d.tag.y), pos = tr.mapping.map(d.tag.a)
tr.setBlockType(pos, pos, schema.nodes.heading, {level: 1})
testTransform(tr, doc(p("far"), h1("baz</a><a>")))
})
</a>
it("spots different text", () =>
end(doc(p("foob<a>ar")),
doc(p("foocar"))))
</a>
it("completes a plus across two bounds", () =>
fill3("paragraph{4}", doc(p()), doc(p()), doc(p()), doc(), doc(p())))
it("notices when one node is longer", () =>
start(doc(p("a", em("b")), p("hello"), blockquote(h1("bye")), "<a>"),
doc(p("a", em("b")), p("hello"), blockquote(h1("bye")), p("oops"))))
</a>
it("rebuilds subtrees correctly at an offset", () => {
let d = doc(p("foobar"), ul(li(p("abc")), li(p("b"))))
let set = build(d, {pos: 18})
let tr = new Transform(d).join(16)
ist(set.map(tr.mapping, tr.doc).find().map(d => d.from).join(), "16")
})
it("returns null when there is no difference", () =>
end(doc(p("a", em("b")), p("hello"), blockquote(h1("bye"))),
doc(p("a", em("b")), p("hello"), blockquote(h1("bye")))))
it("allows typing over a leaf node", () => {
let state = new TestState({doc: doc(p("a"), "<a>", hr, p("b")), schema})
state.nodeSel(3)
state.apply(state.tr.replaceSelectionWith(schema.text("x")))
ist(state.doc, doc(p("a"), p("x"), p("b")), eq)
ist(state.selection.head, 5)
ist(state.selection.anchor, 5)
})
</a>
it("works after a widget", () => {
let d = doc(p("fo<a>o")), w = document.createElement("span")
w.textContent = "!"
let view = tempEditor({doc: d, decorations() {
return DecorationSet.create(d, [Decoration.widget(3, w)])
}})
ist(!view.endOfTextblock("backward"))
})
})</a>
it("ignores attributes", () =>
test(doc(h1("x")), doc(h2("x"))))
it("keeps the node type even when empty", () =>
rpl(doc(h1("<a>bar"), "<b>"),
doc(p("foo</b></a><b><a>baz"), "<b>"),
doc(h1("baz"))))
</b></a></b>