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