UNPKG

@etsoo/shared

Version:

TypeScript shared utilities and functions

36 lines (35 loc) 754 B
/** * A mock implementation of DOMRect for testing purposes */ export 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; } }