2023-04-13 22:48:29 +03:00
|
|
|
import { fromAny, fromPartial } from '@total-typescript/shoehorn';
|
2021-09-19 11:57:36 +03:00
|
|
|
|
|
|
|
const createLinkMock = () => ({
|
2023-05-27 12:57:26 +03:00
|
|
|
setAttribute: vi.fn(),
|
|
|
|
click: vi.fn(),
|
2021-09-19 11:57:36 +03:00
|
|
|
style: {},
|
|
|
|
});
|
|
|
|
|
2023-05-27 12:57:26 +03:00
|
|
|
export const appendChild = vi.fn();
|
2021-09-19 11:57:36 +03:00
|
|
|
|
2023-05-27 12:57:26 +03:00
|
|
|
export const removeChild = vi.fn();
|
2021-09-19 11:57:36 +03:00
|
|
|
|
2023-04-13 22:48:29 +03:00
|
|
|
export const windowMock = fromPartial<Window>({
|
|
|
|
document: fromAny({
|
2023-05-27 12:57:26 +03:00
|
|
|
createElement: vi.fn(createLinkMock),
|
2021-09-19 11:57:36 +03:00
|
|
|
body: { appendChild, removeChild },
|
2023-04-13 22:48:29 +03:00
|
|
|
}),
|
2021-09-19 11:57:36 +03:00
|
|
|
});
|