import { expect, fixture, html } from '@open-wc/testing'; import { getAriaElementsInRightDomOrder } from '../../src/utils/getAriaElementsInRightDomOrder.js'; describe('getAriaElementsInRightDomOrder', () => { it('orders by putting preceding siblings and local parents first', async () => { const el = await fixture(html`
`); // eslint-disable-next-line no-unused-vars const [a, _1, b, _2, bChild, _3, c, _4] = el.querySelectorAll('div'); const unorderedNodes = [bChild, c, a, b]; const result = getAriaElementsInRightDomOrder(unorderedNodes); expect(result).to.eql([a, b, bChild, c]); }); it('can order reversely', async () => { const el = await fixture(html`
`); // eslint-disable-next-line no-unused-vars const [a, _1, b, _2, bChild, _3, c, _4] = el.querySelectorAll('div'); const unorderedNodes = [bChild, c, a, b]; const result = getAriaElementsInRightDomOrder(unorderedNodes, { reverse: true }); expect(result).to.eql([c, bChild, b, a]); }); });