Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 });
});
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 });
});
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')));
});
});