How to use the prosemirror-test-builder.em 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-dom.js View on Github external
it("ignores !<p></p>",
               doc(p("hello!"))))

    it("can handle a head/body input structure",
       recover("<title>T</title>hi",
               doc(p("hi"))))

    it("only applies a mark once",
       recover("<p>A <strong>big <strong>strong</strong> monster</strong>.</p>",
               doc(p("A ", strong("big strong monster"), "."))))

    it("interprets font-style: italic as em",
       recover("<p><span style="font-style: italic">Hello</span>!</p>",
               doc(p(em("Hello"), "!"))))

    it("interprets font-weight: bold as strong",
       recover("<p style="font-weight: bold">Hello</p>",
               doc(p(strong("Hello")))))

    it("ignores unknown inline tags",
       recover("<p><u>a</u>bc</p>",
               doc(p("abc"))))

    it("can add marks specified before their parent node is opened",
       recover("<em>hi</em> you",
               doc(p(em("hi"), " you"))))

    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")))))
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("can remove across blocks", () =&gt;
       rem(doc(blockquote(p(em("much <a>em")), p(em("here too"))), p("between", em("...")), p(em("end<b>"))),
           schema.mark("em"),
           doc(blockquote(p(em("much "), "em"), p("here too")), p("between..."), p("end"))))
</b></a>
github ProseMirror / prosemirror-changeset / test / test-diff.js View on Github external
it("ignores marks in diffing", () =>
     test(doc(p("abcdefghi")), doc(p(em("x"), strong("bc"), "defgh", em("y"))),
          [1, 2, 1, 2], [9, 10, 9, 10]))
github ProseMirror / prosemirror-state / test / test-selection.js View on Github external
it("preserves marks when typing over marked text", () =&gt; {
    let state = new TestState({doc: doc(p("foo ", em("<a>bar<b>"), " baz"))})
    state.apply(state.tr.insertText("quux"))
    ist(state.doc, doc(p("foo ", em("quux"), " baz")), eq)
    state.apply(state.tr.insertText("bar", 5, 9))
    ist(state.doc, doc(p("foo ", em("bar"), " baz")), eq)
  })
</b></a>
github ProseMirror / prosemirror-model / test / test-dom.js View on Github external
it("will open all the way to the inner nodes",
       open("<ul><li>foo</li><li>bar<br></li></ul>", [ul(li(p("foo")), li(p("bar", br)))], 3, 3))

    it("accepts content open to the left",
       open("<li><ul><li>a</li></ul></li>", [li(ul(li(p("a"))))], 4, 4))

    it("accepts content open to the right",
       open("<li>foo</li><li></li>", [li(p("foo")), li()], 2, 1))

    it("will create textblocks for block nodes",
       open("<div><div>foo</div><div>bar</div></div>", [p("foo"), p("bar")], 1, 1))

    it("can parse marks at the start of defaulted textblocks",
       open("<div>foo</div><div><em>bar</em></div>",
            [p("foo"), p(em("bar"))], 1, 1))

    function find(html, doc) {
      return () =&gt; {
        let dom = document.createElement("div")
        dom.innerHTML = html
        let tag = dom.querySelector("var"), prev = tag.previousSibling, next = tag.nextSibling, pos
        if (prev &amp;&amp; next &amp;&amp; prev.nodeType == 3 &amp;&amp; next.nodeType == 3) {
          pos = {node: prev, offset: prev.nodeValue.length}
          prev.nodeValue += next.nodeValue
          next.parentNode.removeChild(next)
        } else {
          pos = {node: tag.parentNode, offset: Array.prototype.indexOf.call(tag.parentNode.childNodes, tag)}
        }
        tag.parentNode.removeChild(tag)
        let result = parser.parse(dom, {
          findPositions: [pos]
github ProseMirror / prosemirror-model / test / test-mark.js View on Github external
it("considers a mark active after the mark", () =&gt;
       isAt(doc(p(em("hi"), "<a> there")), em_, true))
</a>
github ProseMirror / prosemirror-model / test / test-mark.js View on Github external
it("considers a mark inactive before the mark", () =&gt;
       isAt(doc(p("one <a>", em("two"))), em_, false))
</a>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("only clears markup when needed", () =&gt;
       type(doc(p("hello<a> ", em("world"))),
            doc(h1("hello</a><a> ", em("world"))),
            "heading", {level: 1}))
</a>