From 5b40eb4e3d4bb3426172c4eb6d4c63a4aeec28f6 Mon Sep 17 00:00:00 2001 From: "josh.bagwell" Date: Tue, 19 Nov 2024 12:51:45 -0700 Subject: [PATCH] fix: Updated Select Preview spec --- cypress/component/SelectPreview.spec.tsx | 17 ++++++++--------- .../breadcrumbs/stories/examples/Overflow.tsx | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/cypress/component/SelectPreview.spec.tsx b/cypress/component/SelectPreview.spec.tsx index 1d5a560cc9..c9dec38c94 100644 --- a/cypress/component/SelectPreview.spec.tsx +++ b/cypress/component/SelectPreview.spec.tsx @@ -199,7 +199,9 @@ describe('Select', () => { }); it('should have focus', () => { - cy.findByRole('listbox').should('have.focus'); + cy.findByRole('button', {name: 'Label'}) + .pipe(h.selectPreview.getMenu) + .should('have.focus'); }); }); @@ -500,8 +502,7 @@ describe('Select', () => { context('when the down arrow key is pressed 2 more times', () => { beforeEach(() => { - cy.realType('{downarrow}'); - cy.realType('{downarrow}'); + cy.realType('{downarrow}{downarrow}'); }); context('the menu', () => { @@ -515,13 +516,13 @@ describe('Select', () => { context('when the down arrow key is pressed 2 more times', () => { beforeEach(() => { - cy.realType('{downarrow}'); - cy.realType('{downarrow}'); + cy.realType('{downarrow}{downarrow}'); }); context('the menu', () => { it('should set assistive focus to the first option down ("Mobile Phone") since the second option down ("Telegram", which also happens to be the last option) is disabled', () => { - cy.findByRole('listbox') + cy.findByRole('button', {name: 'Label (Disabled Options)'}) + .pipe(h.selectPreview.getMenu) .pipe(getAssistiveFocus) .should('have.text', 'Mobile Phone'); }); @@ -596,9 +597,7 @@ describe('Select', () => { context('when "s{500ms delay}s" is typed', () => { beforeEach(() => { - cy.findByRole('button', {name: 'Label'}).realType('s'); - cy.wait(1000); - cy.realType('s'); + cy.findByRole('button', {name: 'Label'}).realType('ss', {delay: 500}); }); context('the select button', () => { diff --git a/modules/react/breadcrumbs/stories/examples/Overflow.tsx b/modules/react/breadcrumbs/stories/examples/Overflow.tsx index a70d24fc77..1bacfee3b4 100644 --- a/modules/react/breadcrumbs/stories/examples/Overflow.tsx +++ b/modules/react/breadcrumbs/stories/examples/Overflow.tsx @@ -59,7 +59,6 @@ export const OverflowBreadcrumbs = ({width = '100%'}) => { { - console.log('you called?'); setContainerWidth(data.id); }} >