How to use the jest-prosemirror.doc 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-utils.spec.ts View on Github external
it('removes block top level nodes at specified position', () => {
    const {
      state: { tr },
    } = createEditor(doc(p('x'), p('one')));
    const newTr = removeNodeAtPosition({ pos: 3, tr });
    expect(newTr).not.toBe(tr);
    expect(newTr.doc).toEqualProsemirrorNode(doc(p('x')));
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / dom-utils.spec.ts View on Github external
it('returns false for a doc with nothing inside', () => {
    expect(isDocNodeEmpty(doc())).toBeFalse();
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / command-utils.spec.ts View on Github external
it('toggles to the specified type', () => {
    const from = doc(p('toggled'));
    const to = doc(h1('toggled'));
    expect(
      toggleBlockItem({
        type: schema.nodes.heading,
        toggleType: schema.nodes.paragraph,
        attrs: { level: 1 },
      }),
    ).toTransformNode({
      from,
      to,
    });
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / command-utils.spec.ts View on Github external
it('toggles to the specified list type', () => {
    const from = doc(p('make list'));
    const to = doc(ul(li(p('make list'))));
    expect(toggleList(schema.nodes.bulletList, schema.nodes.listItem)).toTransformNode({
      from,
      to,
    });
  });
});
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / command-utils.spec.ts View on Github external
it('lifts the node when already wrapped', () => {
    const from = doc(p(blockquote('Lift me')));
    const to = doc(blockquote('Lift me'));
    expect(toggleWrap(schema.nodes.blockquote)).toTransformNode({ from, to });
  });
});
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('supports non-nested leaf nodes', () => {
    const node = atomBlock();
    const {
      state: { selection },
    } = createEditor(doc(p('abcd'), node, ''));
    const position = findPositionOfNodeBefore(selection);
    expect(position).toEqual({ pos: 6, start: 6, end: 7, node });
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-rules.spec.ts View on Github external
.callback(content => {
        expect(content.doc).toEqualProsemirrorNode(
          doc(
            p('Some ', strong('@test'), ' ', strong('@content')),
            p('should ', strong('@be'), ' amazing'),
            p(''),
          ),
        );
      });
  });