Skip to content

Commit 3395f62

Browse files
test(accordion-web): update focus handling in tests
1 parent 8d73183 commit 3395f62

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

packages/pluggableWidgets/accordion-web/src/components/__tests__/Accordion.spec.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ describe("Accordion", () => {
5555

5656
const accordion = renderAccordion({ groups });
5757
const buttons = accordion.getAllByRole("button");
58-
buttons[0].focus();
5958

59+
await user.tab();
6060
await user.keyboard("{ArrowDown}");
6161

6262
expect(buttons[1]).toHaveFocus();
@@ -69,8 +69,9 @@ describe("Accordion", () => {
6969
const accordion = renderAccordion({ groups });
7070

7171
const buttons = accordion.getAllByRole("button");
72-
buttons[buttons.length - 1].focus();
7372

73+
await user.tab();
74+
await user.tab();
7475
await user.keyboard("{ArrowUp}");
7576

7677
expect(buttons[0]).toHaveFocus();
@@ -86,8 +87,10 @@ describe("Accordion", () => {
8687
const accordion = renderAccordion({ groups });
8788

8889
const buttons = accordion.getAllByRole("button");
89-
buttons[buttons.length - 1].focus();
9090

91+
await user.tab();
92+
await user.tab();
93+
await user.tab();
9194
await user.keyboard("{Home}");
9295

9396
expect(buttons[0]).toHaveFocus();
@@ -102,8 +105,10 @@ describe("Accordion", () => {
102105

103106
const accordion = renderAccordion({ groups });
104107
const buttons = accordion.getAllByRole("button");
105-
buttons[buttons.length - 1].focus();
106108

109+
await user.tab();
110+
await user.tab();
111+
await user.tab();
107112
await user.keyboard("{End}");
108113

109114
expect(buttons[buttons.length - 1]).toHaveFocus();
@@ -118,8 +123,10 @@ describe("Accordion", () => {
118123

119124
const accordion = renderAccordion({ groups });
120125
const buttons = accordion.getAllByRole("button");
121-
buttons[buttons.length - 1].focus();
122126

127+
await user.tab();
128+
await user.tab();
129+
await user.tab();
123130
await user.keyboard("{ArrowDown}");
124131

125132
expect(buttons[buttons.length - 1]).toHaveFocus();

packages/pluggableWidgets/accordion-web/src/components/__tests__/AccordionGroup.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ describe("AccordionGroup", () => {
303303
expect(accordionGroup.asFragment()).toMatchSnapshot();
304304
});
305305

306-
it("renders the content when the group becomes visible dinamically", () => {
306+
it("renders the content when the group becomes visible dynamically", () => {
307307
const accordionGroup = renderAccordionGroup({
308308
collapsed: false,
309309
visible: false

packages/pluggableWidgets/accordion-web/src/components/__tests__/__snapshots__/AccordionGroup.spec.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ exports[`AccordionGroup loadContent behaviour renders widgets when 'loadContent'
358358
</DocumentFragment>
359359
`;
360360

361-
exports[`AccordionGroup not collapsible renders the content when the group becomes visible dinamically 1`] = `
361+
exports[`AccordionGroup not collapsible renders the content when the group becomes visible dynamically 1`] = `
362362
<DocumentFragment>
363363
<section
364364
class="widget-accordion-group class-name"

0 commit comments

Comments
 (0)