diff --git a/packages/core/src/toast/toast.test.tsx b/packages/core/src/toast/toast.test.tsx index 8cf0678f..e476b3ee 100644 --- a/packages/core/src/toast/toast.test.tsx +++ b/packages/core/src/toast/toast.test.tsx @@ -507,8 +507,8 @@ describe("Toast", () => { expect(toasts.length).toBe(limit); }); - it("should not render dismissed toasts", async () => { - const limit = 3; + it("should not use dismissed toasts for list", async () => { + const limit = 1; let closeId: number; @@ -527,27 +527,28 @@ describe("Toast", () => { type="button" data-testid="trigger" onClick={() => { - showToast(); closeId = showToast(); }} > - Show more than limit + Show Toast - + )); fireEvent.click(getByTestId("trigger")); - let toasts = getAllByRole("status"); + fireEvent.click(getByTestId("dismiss-toast")); - expect(toasts.length).toBe(2); + let toasts = + getByTestId("custom-region").querySelectorAll('[role="status"]'); + expect(toasts.length).toBe(0); - fireEvent.click(getByTestId("dismiss-toast")); + fireEvent.click(getByTestId("trigger")); - toasts = getAllByRole("status"); + toasts = getByTestId("custom-region").querySelectorAll('[role="status"]'); expect(toasts.length).toBe(1); });