How to use the prosemirror-test-builder.schema.node 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("wraps an array", () =>
       from([schema.node("hard_break"), schema.text("foo")], p(br, "foo")))
github ProseMirror / prosemirror-state / test / test-selection.js View on Github external
it("can replace a block selection", () => {
    let state = new TestState({doc: doc(p("abc"), hr, hr, blockquote(p("ow"))), schema})
    state.nodeSel(5)
    state.apply(state.tr.replaceSelectionWith(schema.node("code_block")))
    ist(state.doc, doc(p("abc"), pre(), hr, blockquote(p("ow"))), eq)
    ist(state.selection.from, 7)
    state.nodeSel(8)
    state.apply(state.tr.replaceSelectionWith(schema.node("paragraph")))
    ist(state.doc, doc(p("abc"), pre(), hr, p()), eq)
    ist(state.selection.from, 9)
  })
github ProseMirror / prosemirror-state / test / test-selection.js View on Github external
it("moves after an inserted leaf node", () => {
    let state = new TestState({doc: doc(p("foobar")), schema})
    state.textSel(4)
    state.apply(state.tr.replaceSelectionWith(schema.node("horizontal_rule")))
    ist(state.doc, doc(p("foo"), hr, p("bar")), eq)
    ist(state.selection.head, 7)
    state.textSel(10)
    state.apply(state.tr.replaceSelectionWith(schema.node("horizontal_rule")))
    ist(state.doc, doc(p("foo"), hr, p("bar"), hr), eq)
    ist(state.selection.from, 11)
  })
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("can insert two block nodes", () =>
       ins(doc(p("one"), "<a>", p("two&lt;2&gt;")),
           [schema.node("paragraph", null, [schema.text("hi")]),
            schema.node("horizontal_rule")],
           doc(p("one"), p("hi"), hr, "</a><a>", p("two&lt;2&gt;"))))
</a>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("can insert two block nodes", () =&gt;
       ins(doc(p("one"), "<a>", p("two&lt;2&gt;")),
           [schema.node("paragraph", null, [schema.text("hi")]),
            schema.node("horizontal_rule")],
           doc(p("one"), p("hi"), hr, "</a><a>", p("two&lt;2&gt;"))))
</a>
github ProseMirror / prosemirror-model / test / test-node.js View on Github external
it("wraps a single node", () =>
       from(schema.node("paragraph"), doc(p())))
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("can insert a break", () =&gt;
       ins(doc(p("hello<a>there")),
           schema.node("hard_break"),
           doc(p("hello", br, "</a><a>there"))))
</a>
github ProseMirror / prosemirror-state / test / test-selection.js View on Github external
it("can replace a block selection", () => {
    let state = new TestState({doc: doc(p("abc"), hr, hr, blockquote(p("ow"))), schema})
    state.nodeSel(5)
    state.apply(state.tr.replaceSelectionWith(schema.node("code_block")))
    ist(state.doc, doc(p("abc"), pre(), hr, blockquote(p("ow"))), eq)
    ist(state.selection.from, 7)
    state.nodeSel(8)
    state.apply(state.tr.replaceSelectionWith(schema.node("paragraph")))
    ist(state.doc, doc(p("abc"), pre(), hr, p()), eq)
    ist(state.selection.from, 9)
  })
github ProseMirror / prosemirror-view / test / test-decoration.js View on Github external
it("doesn't doubly map decorations nested in multiple nodes", () => {
      let d = doc(h1("u"), blockquote(p()))
      let set = build(d, {pos: 5})
      let tr = new Transform(d).replaceWith(0, 3, schema.node("heading", {level: 1}))
      ist(set.map(tr.mapping, tr.doc).find().map(d => d.from).join(), "4")
    })
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("can insert at the end of a blockquote", () =&gt;
       ins(doc(blockquote(p("hey"), "<a>"), p("after")),
           schema.node("paragraph"),
           doc(blockquote(p("hey"), p()), p("after"))))
</a>