How to use the prosemirror-test-builder.a 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-model / test / test-node.js View on Github external
    it("can serialize marks", () => roundTrip(doc(p("foo", em("bar", strong("baz")), " ", a("x")))))
github ProseMirror / prosemirror-view / test / test-domchange.js View on Github external
it("notices text added to a cursor wrapper at the start of a mark", () => {
    let view = tempEditor({doc: doc(p(strong(a("foo<a>"), "bar")))})
    findTextNode(view.dom, "foo").nodeValue = "fooxy"
    flush(view)
    ist(view.state.doc, doc(p(strong(a("foo"), "xybar"))), eq)
  })
</a>
github ProseMirror / prosemirror-model / test / test-dom.js View on Github external
"<p>hello</p>"))

    it("can represent a line break",
       test(doc(p("hi", br, "there")),
            "<p>hi<br>there</p>"))

    it("can represent an image",
       test(doc(p("hi", img({alt: "x"}), "there")),
            '<p>hi<img alt="x" src="img.png">there</p>'))

    it("joins styles",
       test(doc(p("one", strong("two", em("three")), em("four"), "five")),
            "<p>one<strong>two</strong><em><strong>three</strong>four</em>five</p>"))

    it("can represent links",
       test(doc(p("a ", a({href: "foo"}, "big ", a({href: "bar"}, "nested"), " link"))),
            "<p>a <a href="\&quot;foo\&quot;">big </a><a href="\&quot;bar\&quot;">nested</a><a href="\&quot;foo\&quot;"> link</a></p>"))

    it("can represent and unordered list",
       test(doc(ul(li(p("one")), li(p("two")), li(p("three", strong("!")))), p("after")),
            "<ul><li><p>one</p></li><li><p>two</p></li><li><p>three<strong>!</strong></p></li></ul><p>after</p>"))

    it("can represent an ordered list",
       test(doc(ol(li(p("one")), li(p("two")), li(p("three", strong("!")))), p("after")),
            "<ol><li><p>one</p></li><li><p>two</p></li><li><p>three<strong>!</strong></p></li></ol><p>after</p>"))

    it("can represent a blockquote",
       test(doc(blockquote(p("hello"), p("bye"))),
            "<blockquote><p>hello</p><p>bye</p></blockquote>"))

    it("can represent a nested blockquote",
       test(doc(blockquote(blockquote(blockquote(p("he said"))), p("i said"))),
github ProseMirror / prosemirror-view / test / test-domchange.js View on Github external
it("removes cursor wrapper text when the wrapper otherwise remains valid", () =&gt; {
    let view = tempEditor({doc: doc(p(a(strong("foo<a>"), "bar")))})
    findTextNode(view.dom, "foo").nodeValue = "fooq"
    flush(view)
    ist(view.state.doc, doc(p(a(strong("fooq"), "bar"))), eq)
    ist(!findTextNode(view.dom, "\ufeffq"))
  })
</a>
github ProseMirror / prosemirror-model / test / test-slice.js View on Github external
it("preserves styles after cut", () =&gt;
       t(doc(p("a sentence with an ", em("emphasized ", a("li<a>nk")), " in it")),
         doc(p(em(a("nk")), " in it")), 1, 0))
</a>
github ProseMirror / prosemirror-state / test / test-selection.js View on Github external
it("doesn't preserve non-inclusive marks of a deleted selection", () =&gt; {
    let state = new TestState({doc: doc(p("foo", a(em("<a>bar<b>")), "baz"))})
    state.deleteSelection()
    ist(state.state.storedMarks.length, 1)
  })
</b></a>
github ProseMirror / prosemirror-view / test / test-endOfTextblock.js View on Github external
it("works for virtual motion when in a mark", () =&gt; {
    let view = tempEditor({doc: doc(p(a("fo<a>o "), new Array(50).join("foo "), a("fo<b>o "),
                                      new Array(50).join("foo "), a("foo")))})
    ist(view.endOfTextblock("up"))
    ist(!view.endOfTextblock("down"))
    view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, view.state.doc.tag.b)))
    ist(!view.endOfTextblock("up"))
    ist(!view.endOfTextblock("down"))
    view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, view.state.doc.tag.c)))
    ist(!view.endOfTextblock("up"))
    ist(view.endOfTextblock("down"))
  })
</b></a>
github ProseMirror / prosemirror-view / test / test-endOfTextblock.js View on Github external
it("works for virtual motion when in a mark", () =&gt; {
    let view = tempEditor({doc: doc(p(a("fo<a>o "), new Array(50).join("foo "), a("fo<b>o "),
                                      new Array(50).join("foo "), a("foo")))})
    ist(view.endOfTextblock("up"))
    ist(!view.endOfTextblock("down"))
    view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, view.state.doc.tag.b)))
    ist(!view.endOfTextblock("up"))
    ist(!view.endOfTextblock("down"))
    view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, view.state.doc.tag.c)))
    ist(!view.endOfTextblock("up"))
    ist(view.endOfTextblock("down"))
  })
</b></a>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("should overwrite marks with different attributes", () =&gt;
       add(doc(p("this is a ", a("<a>link<b>"))),
           schema.mark("link", {href: "bar"}),
           doc(p("this is a ", a({href: "bar"}, "link")))))
</b></a>