Skip to content

Commit

Permalink
Use 3 options instead of 2
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Aug 7, 2024
1 parent d6f7bb9 commit cd325f9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/Dropdown/Dropdown.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default {
values: [
["Option1", "Option 1"],
["Option2", "Option 2"],
["Option3", "Option 3"],
],
},
} satisfies Meta<ComponentProps<typeof Dropdown>>;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dropdown/Dropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ describe("Dropdown", () => {
expect(getByRole("option", { name: "Option 1" })).toHaveFocus();

await act(async () => userEvent.keyboard("{End}"));
expect(getByRole("option", { name: "Option 2" })).toHaveFocus();
expect(getByRole("option", { name: "Option 3" })).toHaveFocus();

await act(async () => userEvent.keyboard("{Enter}"));

await waitFor(() => {
expect(getByRole("combobox")).toHaveTextContent("Option 2");
expect(getByRole("combobox")).toHaveTextContent("Option 3");
expect(getByRole("combobox")).toHaveAttribute("aria-expanded", "false");
});
});
Expand Down
48 changes: 48 additions & 0 deletions src/components/Dropdown/__snapshots__/Dropdown.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ exports[`Dropdown > can be opened 1`] = `
Option 2
</li>
<li
aria-selected="false"
role="option"
tabindex="0"
>
Option 3
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -135,6 +143,14 @@ exports[`Dropdown > can select a value 1`] = `
/>
</svg>
</li>
<li
aria-selected="false"
role="option"
tabindex="0"
>
Option 3
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -200,6 +216,14 @@ exports[`Dropdown > renders a Default dropdown 1`] = `
Option 2
</li>
<li
aria-selected="false"
role="option"
tabindex="0"
>
Option 3
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -276,6 +300,14 @@ exports[`Dropdown > renders a dropdown with a default value 1`] = `
/>
</svg>
</li>
<li
aria-selected="false"
role="option"
tabindex="0"
>
Option 3
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -341,6 +373,14 @@ exports[`Dropdown > renders a dropdown with a help label 1`] = `
Option 2
</li>
<li
aria-selected="false"
role="option"
tabindex="0"
>
Option 3
</li>
</ul>
</div>
<span
Expand Down Expand Up @@ -411,6 +451,14 @@ exports[`Dropdown > renders a dropdown with an error 1`] = `
Option 2
</li>
<li
aria-selected="false"
role="option"
tabindex="0"
>
Option 3
</li>
</ul>
</div>
<span
Expand Down

0 comments on commit cd325f9

Please sign in to comment.