Skip to content

Commit 27c18c2

Browse files
committed
test(react): blur focused element instead of targeting textarea
1 parent 3bf9289 commit 27c18c2

File tree

1 file changed

+7
-1
lines changed
  • packages/react/test/base/tests/e2e/specs/components

1 file changed

+7
-1
lines changed

packages/react/test/base/tests/e2e/specs/components/inputs.cy.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@ describe('Inputs', () => {
7878
cy.get('ion-input input').focus().blur();
7979
cy.get('ion-input').should('have.class', 'ion-invalid');
8080

81-
cy.get('ion-textarea').shadow().find('textarea').focus().blur();
81+
// Use cy.focused().blur() instead of directly targeting ion-textarea or
82+
// the native textarea element because:
83+
// React 17/18 moves focus to the ion-textarea component
84+
// React 19 moves focus to the native textarea element
85+
// cy.focused() adapts to whichever element is actually focused
86+
cy.get('ion-textarea').shadow().find('textarea').focus();
87+
cy.focused().blur();
8288
cy.get('ion-textarea').should('have.class', 'ion-invalid');
8389
});
8490

0 commit comments

Comments
 (0)