How to use the prosemirror-test-builder.schema.mark 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-transform / test / test-trans.js View on Github external
it("can remove marks from nested nodes", () =>
       rem(doc(p(em("one ", strong("<a>two<b>"), " three"))),
           schema.mark("strong"),
           doc(p(em("one two three")))))
</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>
github ProseMirror / prosemirror-transform / test / test-trans.js View on Github external
it("can add a mark in a nested node", () =&gt;
       add(doc(p("before"), blockquote(p("the variable is called <a>i<b>")), p("after")),
           schema.mark("code"),
           doc(p("before"), blockquote(p("the variable is called ", code("i"))), p("after"))))
</b></a>
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-state / test / test-state.js View on Github external
it("supports specifying and persisting storedMarks", () => {
    let state = EditorState.create({doc: doc(p("ok")), storedMarks: [schema.mark("em")]})
    ist(state.storedMarks.length, 1)
    let copy = EditorState.fromJSON({schema}, state.toJSON())
    ist(copy.storedMarks.length, 1)
  })
github ProseMirror / prosemirror-view / test / test-draw-decoration.js View on Github external
it("draws the specified marks around a widget", () => {
    let view = tempEditor({
      doc: doc(p("foobar")),
      plugins: [decoPlugin([Decoration.widget(4, document.createElement("img"), {marks: [schema.mark("em")]})])]
    })
    ist(view.dom.querySelector("em img"))
  })
github ProseMirror / prosemirror-model / test / test-mark.js View on Github external
let link = (href, title) => schema.mark("link", {href, title})
let code = schema.mark("code")
github ProseMirror / prosemirror-model / test / test-mark.js View on Github external
const {Mark, Schema} = require("..")
const {schema, doc, p, em, a} = require("prosemirror-test-builder")
const ist = require("ist")

let em_ = schema.mark("em")
let strong = schema.mark("strong")
let link = (href, title) => schema.mark("link", {href, title})
let code = schema.mark("code")

let customSchema = new Schema({
  nodes: {doc: {content: "paragraph+"}, paragraph: {content: "text*"}, text: {}},
  marks: {
    remark: {attrs: {id: {}}, excludes: "", inclusive: false},
    user: {attrs: {id: {}}, excludes: "_"},
    strong: {excludes: "em-group"},
    em: {group: "em-group"}
  }
}), custom = customSchema.marks
let remark1 = custom.remark.create({id: 1}), remark2 = custom.remark.create({id: 2}),
    user1 = custom.user.create({id: 1}), user2 = custom.user.create({id: 2}),
    customEm = custom.em.create(), customStrong = custom.strong.create()
github ProseMirror / prosemirror-model / test / test-mark.js View on Github external
const {Mark, Schema} = require("..")
const {schema, doc, p, em, a} = require("prosemirror-test-builder")
const ist = require("ist")

let em_ = schema.mark("em")
let strong = schema.mark("strong")
let link = (href, title) => schema.mark("link", {href, title})
let code = schema.mark("code")

let customSchema = new Schema({
  nodes: {doc: {content: "paragraph+"}, paragraph: {content: "text*"}, text: {}},
  marks: {
    remark: {attrs: {id: {}}, excludes: "", inclusive: false},
    user: {attrs: {id: {}}, excludes: "_"},
    strong: {excludes: "em-group"},
    em: {group: "em-group"}
  }
}), custom = customSchema.marks
let remark1 = custom.remark.create({id: 1}), remark2 = custom.remark.create({id: 2}),
    user1 = custom.user.create({id: 1}), user2 = custom.user.create({id: 2}),
    customEm = custom.em.create(), customStrong = custom.strong.create()

describe("Mark", () => {
  describe("sameSet", () => {
github ProseMirror / prosemirror-model / test / test-mark.js View on Github external
const {Mark, Schema} = require("..")
const {schema, doc, p, em, a} = require("prosemirror-test-builder")
const ist = require("ist")

let em_ = schema.mark("em")
let strong = schema.mark("strong")
let link = (href, title) => schema.mark("link", {href, title})
let code = schema.mark("code")

let customSchema = new Schema({
  nodes: {doc: {content: "paragraph+"}, paragraph: {content: "text*"}, text: {}},
  marks: {
    remark: {attrs: {id: {}}, excludes: "", inclusive: false},
    user: {attrs: {id: {}}, excludes: "_"},
    strong: {excludes: "em-group"},
    em: {group: "em-group"}
  }
}), custom = customSchema.marks
let remark1 = custom.remark.create({id: 1}), remark2 = custom.remark.create({id: 2}),
    user1 = custom.user.create({id: 1}), user2 = custom.user.create({id: 2}),
    customEm = custom.em.create(), customStrong = custom.strong.create()