UNPKG

@etsoo/shared

Version:

TypeScript shared utilities and functions

40 lines (39 loc) 889 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MockDOMRect = void 0; /** * A mock implementation of DOMRect for testing purposes */ class MockDOMRect { bottom; height; left; right; top; width; x; y; toJSON() { return JSON.stringify({ bottom: this.bottom, height: this.height, left: this.left, right: this.right, top: this.top, width: this.width, x: this.x, y: this.y }); } constructor(width, height, x = 0, y = 0) { this.x = x; this.y = y; this.width = width; this.height = height; this.left = x; this.top = y; this.bottom = this.top + this.height; this.right = this.left = this.width; } } exports.MockDOMRect = MockDOMRect;