feat: add empty state and expand overlay qa
This commit is contained in:
@@ -105,4 +105,29 @@ describe("Dialog", () => {
|
||||
expect(within(dialog).getByText("Summary").closest('[data-slot="header"]')).toBeInTheDocument();
|
||||
expect(within(dialog).getByRole("button", { name: "Close" }).closest('[data-slot="footer"]')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("returns focus to the trigger after Escape closes the dialog", async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
render(
|
||||
<Dialog>
|
||||
<DialogTrigger>Open accessible dialog</DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogTitle>Accessibility</DialogTitle>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
const trigger = screen.getByRole("button", { name: "Open accessible dialog" });
|
||||
|
||||
await user.click(trigger);
|
||||
expect(await screen.findByRole("dialog")).toBeInTheDocument();
|
||||
|
||||
await user.keyboard("{Escape}");
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
||||
expect(trigger).toHaveFocus();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user