How to use the jest-prosemirror.blockquote 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 blockquotes', () => {
    const node = blockquote(p(''));
    const {
      state: { selection },
    } = createEditor(doc(p('abcd'), node, ''));
    const position = findPositionOfNodeBefore(selection);
    expect(position).toEqual({ pos: 6, start: 7, end: 10, node });
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('returns false with text selection surrounds the node', () => {
    const { state, schema: sch } = createEditor(
      doc(p('Something', blockquote('is italic'), ' here')),
    );
    expect(isNodeActive({ state, type: sch.nodes.blockquote })).toBeFalse();
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('returns false when not within the node', () => {
    const { state, schema: sch } = createEditor(doc(p('Something', blockquote('hello'))));
    expect(isNodeActive({ state, type: sch.nodes.blockquote })).toBeFalse();
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('returns true when node selection directly before node', () => {
    const { state, schema: sch } = createEditor(doc(p('Something', blockquote('is italic'), 'here')));
    expect(isNodeActive({ state, type: sch.nodes.blockquote })).toBeTrue();
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('shows active when within an active region', () => {
    const { state, schema: sch } = createEditor(doc(p('Something', blockquote('is in blockquote'))));
    expect(isNodeActive({ state, type: sch.nodes.blockquote })).toBeTrue();
  });
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('matches with an array of nodeTypes', () => {
    const { paragraph, blockquote: bq } = schema.nodes;
    expect(nodeEqualsType({ types: [paragraph, bq], node: blockquote() })).toBeTrue();
  });
});
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / dom-utils.spec.ts View on Github external
it('returns true when it successfully matches', () => {
    expect(nodeNameMatchesList(p(), matchers)).toBeTrue();
    expect(nodeNameMatchesList(blockquote(), matchers)).toBeTrue();
    expect(nodeNameMatchesList(table(), matchers)).toBeTrue();
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('returns false nested within other nodes', () => {
    const { state, schema: sch } = createEditor(doc(p('a', p(p(blockquote('is italic')), 'here'))));
    expect(isNodeActive({ state, type: sch.nodes.blockquote })).toBeFalse();
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('should return DOM reference of a content block node', () => {
    const { view } = createEditor(doc(p('one'), blockquote(p('two'))));
    const ref = findElementAtPosition(5, view);
    expect(ref instanceof HTMLQuoteElement).toBe(true);
  });