@empoleon/solid-measure
Version:
Compute measurements of SolidJS components
30 lines (26 loc) • 591 B
text/typescript
import { beforeEach, afterEach, vi } from "vitest";
// Mock DOM methods that might not be available in jsdom
beforeEach(() => {
// Mock getBoundingClientRect if needed
Element.prototype.getBoundingClientRect = vi.fn(() => ({
x: 0,
y: 0,
top: 0,
left: 0,
bottom: 0,
right: 0,
width: 0,
height: 0,
toJSON: vi.fn(),
}));
// Mock getComputedStyle
global.getComputedStyle = vi.fn(() => ({
marginTop: "0px",
marginRight: "0px",
marginBottom: "0px",
marginLeft: "0px",
})) as any;
});
afterEach(() => {
vi.restoreAllMocks();
});