How to use the jest-prosemirror.h2 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('matches nodes by specified attributes', () => {
    const { state, schema: sch } = createEditor(doc(p('Something', h2('is  heading'), 'here')));
    expect(isNodeActive({ state, type: sch.nodes.heading, attrs: { level: 1 } })).toBeFalse();
    expect(isNodeActive({ state, type: sch.nodes.heading, attrs: { level: 2 } })).toBeTrue();
  });
});
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
describe('findNodeAt...', () => {
  const expectedEnd = h2('Heading here');
  const expectedStart = p(' I am champion');
  const pmDoc = doc(expectedStart, expectedEnd);

  test('findNodeAtSelection', () => {
    const selection = Selection.atEnd(pmDoc);
    const { node, pos, start } = findNodeAtSelection(selection);
    expect(node).toBe(expectedEnd);
    expect(pos).toBe(16);
    expect(start).toBe(17);
  });
});