How to use the jest-prosemirror.schema.marks function in jest-prosemirror

To help you get started, we’ve selected a few jest-prosemirror 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 ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-rules.spec.ts View on Github external
it('should not transform when no match found', () => {
    const plugin = markPasteRule({ regexp: /(Hello)/, type: testSchema.marks.strong });
    createEditor(doc(p('')), { plugins: [plugin] })
      .paste('Not The Word')
      .callback(content => {
        expect(content.doc).toEqualProsemirrorNode(doc(p('Not The Word')));
      });
  });
});
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / command-utils.spec.ts View on Github external
test('updateMark', () => {
  const from = doc(p('Make bold'));
  const to = doc(p('Make ', strong('bold')));
  expect(updateMark({ type: schema.marks.strong })).toTransformNode({ from, to });
});
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-rules.spec.ts View on Github external
it('should transform simple content', () => {
    const plugin = markPasteRule({ regexp: /(Hello)/, type: testSchema.marks.strong });
    createEditor(doc(p('')), { plugins: [plugin] })
      .paste('Hello')
      .callback(content => expect(content.doc).toEqualProsemirrorNode(doc(p(strong('Hello')))));
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / command-utils.spec.ts View on Github external
describe('removeMark', () => {
  const type = schema.marks.strong;
  it('removes the contained mark', () => {
    const from = doc(p(strong('bold')));
    const to = doc(p('bold'));
    expect(removeMark({ type })).toTransformNode({ from, to });
  });

  it('leaves mark untouched when `expand` is `false`', () => {
    const from = doc(p(strong('bold')));
    expect(removeMark({ type })).toTransformNode({ from });
  });

  it('removes mark when `expand` is `true`', () => {
    const from = doc(p(strong('bold')));
    const to = doc(p('bold'));
    expect(removeMark({ type, expand: true })).toTransformNode({ from, to });
  });