Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("keeps applying a mark for the all of the node's content",
recover("<p><strong><span>xx</span>bar</strong></p>",
doc(p(strong("xxbar")))))
function parse(html, options, doc) {
return () => {
let dom = document.createElement("div")
dom.innerHTML = html
let result = parser.parse(dom, options)
ist(result, doc, eq)
}
}
it("accepts the topNode option",
parse("<li>wow</li><li>such</li>", {topNode: schema.nodes.bullet_list.createAndFill()},
ul(li(p("wow")), li(p("such")))))
let item = schema.nodes.list_item.createAndFill()
it("accepts the topMatch option",
parse("<ul><li>x</li></ul>", {topNode: item, topMatch: item.contentMatchAt(1)},
li(ul(li(p("x"))))))
it("accepts from and to options",
parse("<hr><p>foo</p><p>bar</p><img>", {from: 1, to: 3},
doc(p("foo"), p("bar"))))
it("accepts the preserveWhitespace option",
parse("foo bar", {preserveWhitespace: true},
doc(p("foo bar"))))
function open(html, nodes, openStart, openEnd) {
let m = get(expr), ts = types ? types.split(" ").map(t => schema.nodes[t]) : []
for (let i = 0; m && i < ts.length; i++) m = m.matchType(ts[i])
it("joins lists when wrapping a paragraph after them in a list", () =>
apply(doc(ul(li(p("a"))), p("b<a>")),
autoJoin(wrapIn(schema.nodes.bullet_list), ["bullet_list"]),
doc(ul(li(p("a")), li(p("b"))))))
</a>
it("will wrap a node with the suitable parent", () =>
ins(doc(p("foo<a>bar")),
schema.nodes.list_item.createAndFill(),
doc(p("foo"), ol(li(p())), p("bar"))))
})</a>
doc(p(strong("xxbar")))))
function parse(html, options, doc) {
return () => {
let dom = document.createElement("div")
dom.innerHTML = html
let result = parser.parse(dom, options)
ist(result, doc, eq)
}
}
it("accepts the topNode option",
parse("<li>wow</li><li>such</li>", {topNode: schema.nodes.bullet_list.createAndFill()},
ul(li(p("wow")), li(p("such")))))
let item = schema.nodes.list_item.createAndFill()
it("accepts the topMatch option",
parse("<ul><li>x</li></ul>", {topNode: item, topMatch: item.contentMatchAt(1)},
li(ul(li(p("x"))))))
it("accepts from and to options",
parse("<hr><p>foo</p><p>bar</p><img>", {from: 1, to: 3},
doc(p("foo"), p("bar"))))
it("accepts the preserveWhitespace option",
parse("foo bar", {preserveWhitespace: true},
doc(p("foo bar"))))
function open(html, nodes, openStart, openEnd) {
return () => {
let dom = document.createElement("div")
dom.innerHTML = html
describe("wrapIn", () => {
let wrap = wrapIn(schema.nodes.blockquote)
it("can wrap a paragraph", () =>
apply(doc(p("fo<a>o")), wrap, doc(blockquote(p("foo")))))
it("wraps multiple pragraphs", () =>
apply(doc(p("fo</a><a>o"), p("bar"), p("ba<b>z"), p("quux")), wrap,
doc(blockquote(p("foo"), p("bar"), p("baz")), p("quux"))))
it("wraps an already wrapped node", () =>
apply(doc(blockquote(p("fo</b></a><b><a>o"))), wrap,
doc(blockquote(blockquote(p("foo"))))))
it("can wrap a node selection", () =>
apply(doc("</a><a>", ul(li(p("foo")))), wrap,
doc(blockquote(ul(li(p("foo")))))))
})</a></b>
function type(doc, expect, nodeType, attrs) {
testTransform(new Transform(doc).setBlockType(doc.tag.a, doc.tag.b || doc.tag.a, schema.nodes[nodeType], attrs),
expect)
}
tr => tr.replaceWith(0, 3, schema.nodes.horizontal_rule.create()))
ist(str(set), "[]")
tr => tr.wrap(tr.doc.resolve(1).blockRange(), [{type: schema.nodes.blockquote}])
], [[0, 0, 0, 1], [1, 1, 2, 4], [2, 2, 5, 6]]))