Skip to content

Commit

Permalink
fix: Updated Select Preview spec
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-bagwell committed Nov 21, 2024
1 parent c130d76 commit 48ce0e0
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions cypress/component/SelectPreview.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ describe('Select', () => {

context('when the down arrow key is pressed', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'}).realPress('{downarrow}');
cy.findByRole('button', {name: 'Label'}).type('{downArrow}');
});

context('the select button', () => {
Expand Down Expand Up @@ -219,7 +219,7 @@ describe('Select', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'})
.pipe(h.selectPreview.getMenu)
.realPress('{downarrow}');
.type('{downArrow}');
});

context('the menu', () => {
Expand All @@ -235,7 +235,10 @@ describe('Select', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'})
.pipe(h.selectPreview.getMenu)
.realPress('{downarrow}');
.should('exist');
cy.findByRole('button', {name: 'Label'})
.pipe(h.selectPreview.getMenu)
.type('{downArrow}');
});

context('the menu', () => {
Expand Down Expand Up @@ -280,7 +283,7 @@ describe('Select', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'})
.pipe(h.selectPreview.getMenu)
.realPress('{downarrow}');
.type('{downArrow}');
});

context('the menu', () => {
Expand All @@ -307,7 +310,7 @@ describe('Select', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'})
.pipe(h.selectPreview.getMenu)
.realPress('{uparrow}');
.type('{upArrow}');
});

context('the menu', () => {
Expand Down Expand Up @@ -377,7 +380,7 @@ describe('Select', () => {
context('when the menu is opened', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'}).focus();
cy.findByRole('button', {name: 'Label'}).realPress('{downarrow}');
cy.findByRole('button', {name: 'Label'}).type('{downArrow}');
});

context('the menu', () => {
Expand All @@ -393,7 +396,7 @@ describe('Select', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'})
.pipe(h.selectPreview.getMenu)
.realPress('{downarrow}');
.type('{downArrow}');
});

context('the menu', () => {
Expand All @@ -409,7 +412,7 @@ describe('Select', () => {
'when the menu is closed WITHOUT selecting the newly focused option ("Phone")',
() => {
beforeEach(() => {
cy.realPress('{esc}');
cy.findByRole('button', {name: 'Label'}).type('{esc}');
});

context('when the menu is re-opened AFTER it has fully closed', () => {
Expand All @@ -420,7 +423,7 @@ describe('Select', () => {
cy.findByRole('button', {name: 'Label'})
.pipe(h.selectPreview.getMenu)
.should('not.exist');
cy.findByRole('button', {name: 'Label'}).focus().realPress('{downarrow}');
cy.findByRole('button', {name: 'Label'}).focus().type('{downArrow}');
});

context('the menu', () => {
Expand All @@ -435,9 +438,7 @@ describe('Select', () => {

context('when the menu is re-opened BEFORE it has fully closed', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'})
.pipe(h.selectPreview.getMenu)
.realPress('{downarrow}');
cy.findByRole('button', {name: 'Label'}).type('{downArrow}');
});

context('the menu', () => {
Expand Down Expand Up @@ -481,9 +482,7 @@ describe('Select', () => {

context('when the menu is opened', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label (Disabled Options)'})
.focus()
.realPress('{downarrow}');
cy.findByRole('button', {name: 'Label (Disabled Options)'}).focus().type('{downArrow}');
});

context('the "Carrier Pigeon" option', () => {
Expand All @@ -498,7 +497,7 @@ describe('Select', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label (Disabled Options)'})
.pipe(h.selectPreview.getMenu)
.realPress('{downarrow}');
.type('{downArrow}');
});

context('the menu', () => {
Expand Down Expand Up @@ -609,7 +608,7 @@ describe('Select', () => {
() => {
context('when "s" is typed', () => {
beforeEach(() => {
cy.findByRole('button', {name: 'Label'}).realPress('s');
cy.findByRole('button', {name: 'Label'}).realType('s');
});

context('the select button', () => {
Expand Down

0 comments on commit 48ce0e0

Please sign in to comment.