import React from 'react';
import { mount } from '@cypress/react';
import { getFocusTargets } from '../focus';
it('detects typical focusable elements', () => {
const Tabbables = () => (
);
mount();
cy.get('#start').focus();
const actualTargets: HTMLElement[] = [];
for (let i = 0; i < 5; i++) {
cy.realPress('Tab');
cy.focused().should('not.have.class', 'ignored').then($el => {
actualTargets.push($el.get(0));
});
}
cy.get('.targets').then($el => {
const element = $el.get(0);
expect(getFocusTargets(element)).to.deep.equal(actualTargets);
});
});