Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import { render } from "@testing-library/react";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const { sonnerToaster } = vi.hoisted(() => ({
|
||||
sonnerToaster: vi.fn(() => null),
|
||||
}));
|
||||
|
||||
vi.mock("sonner", () => ({
|
||||
Toaster: (props: unknown) => sonnerToaster(props),
|
||||
}));
|
||||
|
||||
import { GLOBAL_TOAST_DURATION_MS, Toaster } from "./sonner";
|
||||
|
||||
describe("global toast presentation", () => {
|
||||
beforeEach(() => sonnerToaster.mockClear());
|
||||
|
||||
it("uses the same position, duration and semantic skin on every surface", () => {
|
||||
render(<Toaster />);
|
||||
|
||||
expect(sonnerToaster).toHaveBeenCalledOnce();
|
||||
expect(sonnerToaster).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
position: "top-center",
|
||||
duration: GLOBAL_TOAST_DURATION_MS,
|
||||
toastOptions: expect.objectContaining({
|
||||
classNames: expect.objectContaining({
|
||||
success: expect.stringContaining("bg-surface-feedback-subtle-positive!"),
|
||||
error: expect.stringContaining("bg-surface-feedback-subtle-negative!"),
|
||||
warning: expect.stringContaining("bg-surface-feedback-subtle-warning!"),
|
||||
info: expect.stringContaining("bg-surface-feedback-subtle-information!"),
|
||||
}),
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps an explicit duration override without changing the global position", () => {
|
||||
render(<Toaster duration={9000} />);
|
||||
|
||||
expect(sonnerToaster).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ position: "top-center", duration: 9000 })
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user