Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/clipboard/test/copy-status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ describe("createCopyToClipboard", () => {
let writeText: ReturnType<typeof vi.spyOn>;
beforeEach(() => {
vi.useFakeTimers();
writeText = vi.spyOn(navigator.clipboard, "writeText");
// Don't call through: the shared mock keeps whatever was written, which leaks into
// index.test.ts when both files run in the same worker.
writeText = vi.spyOn(navigator.clipboard, "writeText").mockResolvedValue(undefined);
});
afterEach(() => {
vi.useRealTimers();
Expand Down Expand Up @@ -122,7 +124,7 @@ describe("createCopyToClipboard", () => {
it("copy() supports ClipboardItem arrays", async () => {
const { api, dispose } = setup();
const item = {} as ClipboardItem;
const write = vi.spyOn(navigator.clipboard, "write");
const write = vi.spyOn(navigator.clipboard, "write").mockResolvedValue(undefined);
await expect(api.copy([item])).resolves.toBe(true);
expect(write).toHaveBeenCalledWith([item]);
flush();
Expand Down
Loading