Skip to content

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed Apr 14, 2024
1 parent 58b9b4a commit c2c2874
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
40 changes: 25 additions & 15 deletions packages/happy-dom/src/nodes/element/DOMRect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,36 @@ export default class DOMRect {
* @param [height] Height.
*/
constructor(x?, y?, width?, height?) {
this.x = x || 0;
this.y = y || 0;
this.width = width || 0;
this.height = height || 0;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.top = this.y;
this.right = this.x + this.width;
this.bottom = this.y + this.height;
this.left = this.x;
}
static fromRect(rectangle: {
x: number;
y: number;
width: number;
height: number;
} = {
x: 0,
y: 0,
width: 0,
height: 0
}) {
/**
* The fromRect() static method of the DOMRect object creates a new DOMRect object with a given location and dimensions.
* @param rectangle
* @param rectangle.x
* @param rectangle.y
* @param rectangle.width
* @param rectangle.height
*/
public static fromRect(
rectangle: {
x?: number;
y?: number;
width?: number;
height?: number;
} = {
x: 0,
y: 0,
width: 0,
height: 0
}
): DOMRect {
return new DOMRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
}
}
2 changes: 1 addition & 1 deletion packages/happy-dom/test/nodes/element/Element.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ describe('Element', () => {
expect(domRect.bottom).toBe(6);
expect(domRect.left).toBe(1);
});
})
});

describe('cloneNode()', () => {
it('Clones the properties of the element when cloned.', () => {
Expand Down

0 comments on commit c2c2874

Please sign in to comment.