diff --git a/packages/happy-dom/src/nodes/element/DOMRect.ts b/packages/happy-dom/src/nodes/element/DOMRect.ts index 86d433a6c..26bffb801 100644 --- a/packages/happy-dom/src/nodes/element/DOMRect.ts +++ b/packages/happy-dom/src/nodes/element/DOMRect.ts @@ -1,5 +1,6 @@ -import DOMRectReadOnly, { IDOMRectInit } from './DOMRectReadOnly.js'; +import DOMRectReadOnly from './DOMRectReadOnly.js'; import * as PropertySymbol from '../../PropertySymbol.js'; +import IDOMRectInit from './IDOMRectInit.js'; /* eslint-disable jsdoc/require-jsdoc */ diff --git a/packages/happy-dom/src/nodes/element/DOMRectReadOnly.ts b/packages/happy-dom/src/nodes/element/DOMRectReadOnly.ts index 65c8bc334..5ca15808b 100644 --- a/packages/happy-dom/src/nodes/element/DOMRectReadOnly.ts +++ b/packages/happy-dom/src/nodes/element/DOMRectReadOnly.ts @@ -1,4 +1,5 @@ import * as PropertySymbol from '../../PropertySymbol.js'; +import IDOMRectInit from './IDOMRectInit.js'; /* eslint-disable jsdoc/require-jsdoc */ @@ -77,10 +78,3 @@ export default class DOMRectReadOnly implements IDOMRectInit { return new DOMRectReadOnly(other.x, other.y, other.width, other.height); } } - -export interface IDOMRectInit { - readonly x: number; - readonly y: number; - readonly width: number; - readonly height: number; -} diff --git a/packages/happy-dom/src/nodes/element/IDOMRectInit.ts b/packages/happy-dom/src/nodes/element/IDOMRectInit.ts new file mode 100644 index 000000000..10cbd1780 --- /dev/null +++ b/packages/happy-dom/src/nodes/element/IDOMRectInit.ts @@ -0,0 +1,6 @@ +export default interface IDOMRectInit { + readonly x: number; + readonly y: number; + readonly width: number; + readonly height: number; +} diff --git a/packages/happy-dom/test/nodes/element/DOMRectReadOnly.test.ts b/packages/happy-dom/test/nodes/element/DOMRectReadOnly.test.ts index c179eedaf..6e712107b 100644 --- a/packages/happy-dom/test/nodes/element/DOMRectReadOnly.test.ts +++ b/packages/happy-dom/test/nodes/element/DOMRectReadOnly.test.ts @@ -13,6 +13,10 @@ describe('DOMRectReadOnly', () => { expect(rect.y).toBe(2); expect(rect.width).toBe(3); expect(rect.height).toBe(4); + expect(rect.top).toBe(2); + expect(rect.right).toBe(4); + expect(rect.bottom).toBe(6); + expect(rect.left).toBe(1); const rect2 = new DOMRectReadOnly(null, null, null, 4); expect(rect2.x).toBe(0); @@ -103,6 +107,10 @@ describe('DOMRectReadOnly', () => { expect(rect.y).toBe(2); expect(rect.width).toBe(3); expect(rect.height).toBe(4); + expect(rect.top).toBe(2); + expect(rect.right).toBe(4); + expect(rect.bottom).toBe(6); + expect(rect.left).toBe(1); }); });