diff --git a/src/components/dropdown/dropdown.stories.tsx b/src/components/dropdown/dropdown.stories.tsx index c335ab6b..0d685d44 100644 --- a/src/components/dropdown/dropdown.stories.tsx +++ b/src/components/dropdown/dropdown.stories.tsx @@ -134,6 +134,11 @@ export const ActivateOnFocus: Story = { await userEvent.keyboard("{Escape}"); await waitFor(() => expect(canvas.queryByRole("dialog")).toBeNull()); await userEvent.tab({ shift: true, delay: 10 }); + + await waitFor(() => + expect(document.activeElement?.textContent).not.toBe("Hover me!"), + ); + await userEvent.tab({ delay: 10 }); await waitFor(() => expect(document.activeElement?.textContent).toBe("Zaaktypen"), @@ -308,9 +313,19 @@ export const NestedDropdown: Story = { expect(document.activeElement?.textContent).toBe("Zaaktypen"), ); - for (let counter = 0; counter < 3; counter++) { - await userEvent.tab({ delay: 20 }); - } + await userEvent.tab({ delay: 20 }); + + await waitFor(() => + expect(document.activeElement?.textContent).toBe("Documenttypen"), + ); + + await userEvent.tab({ delay: 20 }); + + await waitFor(() => + expect(document.activeElement?.textContent).toBe("Admin"), + ); + + await userEvent.tab({ delay: 20 }); await expect(document.activeElement?.textContent).toBe( parameters.lastButtonText,