How to use the jest-prosemirror.atomBlock 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('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-utils.spec.ts View on Github external
it('supports nested leaf nodes', () => {
    const node = atomBlock();
    const {
      state: { selection },
    } = createEditor(doc(p('abcd'), table(row(td(p('1'), node, '')))));
    const position = findPositionOfNodeBefore(selection);
    expect(position).toEqual({ pos: 12, start: 12, end: 13, node });
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('supports removing leaf nodes (atom)', () => {
    const {
      state: { tr },
    } = createEditor(doc(p('one'), atomBlock(), '', p('two')));
    const newTr = removeNodeBefore(tr);
    expect(newTr).not.toBe(tr);
    expect(newTr.doc).toEqualProsemirrorNode(doc(p('one'), p('two')));
  });
});