@qntm-code/utils
Version:
A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.
12 lines (11 loc) • 388 B
JavaScript
import { getAncestors } from '..';
describe('getAncestors', () => {
it('should get ancestors for a given element', () => {
const a = document.createElement('div');
const b = document.createElement('p');
const c = document.createElement('strong');
b.appendChild(c);
a.appendChild(b);
expect(getAncestors(c)).toEqual([b, a]);
});
});