Skip to content

Commit

Permalink
chore(tabs): update a11y cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
weronikaolejniczak committed Nov 8, 2024
1 parent c9e9e24 commit 63b23a6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/eui/src/components/tabs/tabs.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,22 @@ describe('EuiTabs', () => {
it('handles keypress events', () => {
cy.realMount(<TabbedContent />);
cy.realPress('Tab');
cy.realPress(['Shift', 'Tab']);
cy.realPress('ArrowLeft');
// on enter, should select the first tab
cy.realPress('Enter');
cy.get('div[role="tabpanel"]').first().should('exist');
cy.get('div[role="tabpanel"]').should('have.length', 1);
cy.focused().should('have.text', 'Cobalt');
cy.repeatRealPress('Tab', 3);
// on arrow right, should navigate to the next tab
cy.repeatRealPress('ArrowRight', 3);
cy.focused().should('have.text', 'Monosodium Glutamate');
// on arrow right, should loop back to the first tab
cy.repeatRealPress('ArrowRight', 1);
cy.focused().should('have.text', 'Cobalt');
// on arrow left, should loop back to the last tab
cy.repeatRealPress('ArrowLeft', 1);
cy.focused().should('have.text', 'Monosodium Glutamate');
// on enter, should select the last tab
cy.realPress('Enter');
cy.get('div[role="tabpanel"]').last().should('exist');
cy.get('div[role="tabpanel"]').should('have.length', 1);
Expand Down

0 comments on commit 63b23a6

Please sign in to comment.