How to use the jest-prosemirror.tr 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-node-utils.spec.ts View on Github external
it('should return an empty array if a given node does not have text nodes', () => {
    const { state } = createEditor(doc(table(row(tdEmpty))));
    const result = findTextNodes({ node: state.doc.firstChild });
    expect(result.length).toEqual(0);
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-node-utils.spec.ts View on Github external
it('should return an array if child nodes of a given `nodeType`', () => {
    const { state } = createEditor(doc(table(row(tdEmpty, tdEmpty, tdEmpty))));
    const result = findChildrenByNode({ node: state.doc, type: state.schema.nodes.table_cell });
    expect(result.length).toEqual(3);
    result.forEach(item => {
      expect(item.node.type.name).toEqual('table_cell');
    });
  });
});
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-node-utils.spec.ts View on Github external
it('should return an array if block nodes of a given node', () => {
    const { state } = createEditor(doc(table(row(tdEmpty, tdEmpty))));
    const result = findBlockNodes({ node: state.doc.firstChild });
    expect(result.length).toEqual(5);
    result.forEach(item => {
      expect(item.node.isBlock).toBe(true);
    });
  });
});