How to use the jest-prosemirror.atomInline 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 array if text nodes of a given node', () => {
    const { state } = createEditor(doc(table(row(td(p('one', atomInline(), 'two'), td(p('three')))))));
    const result = findTextNodes({ node: state.doc.firstChild });
    expect(result.length).toEqual(3);
    result.forEach(item => {
      expect(item.node.isText).toBe(true);
    });
  });
});
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('should return DOM reference of a paragraph if cursor is inside of a text node', () => {
    const { view } = createEditor(doc(p(atomInline(), 'text')));
    const ref = findElementAtPosition(3, view);
    expect(ref instanceof HTMLParagraphElement).toBe(true);
  });
});
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / command-utils.spec.ts View on Github external
it('replaces valid content', () => {
    const from = doc(p('replace me'));
    const to = doc(p('replace ', atomInline()));
    expect(replaceText({ appendText: '', type: schema.nodes.atomInline })).toTransformNode({ from, to });
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / prosemirror-utils.spec.ts View on Github external
it('should return DOM reference of a nested inline leaf node', () => {
    const { view } = createEditor(doc(p('one', atomInline(), 'two')));
    const ref = findElementAtPosition(4, view);
    expect(ref instanceof HTMLSpanElement).toBe(true);
    expect(ref.getAttribute('data-node-type')).toEqual('atomInline');
  });
github ifiokjr / remirror / @remirror / core-utils / src / __tests__ / dom-utils.spec.ts View on Github external
it('does not throw error for inserting into leaf node', () => {
    const { state, schema } = createEditor(doc(atomInline('')));
    expect(canInsertNode(state, schema.nodes.paragraph)).toBeFalse();
  });
});