-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: tooltip unit test * fix: satisfy git build * fix: for git build * fix: manage resetPdfWorker * fix: pr feedback --------- Co-authored-by: DORIAN MILLER <[email protected]>
- Loading branch information
1 parent
8033a29
commit 288e429
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
packages/discovery-react-components/src/setupTestsUtil.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Helper functions to acount for DOMRect | ||
// guidance https://stackoverflow.com/questions/71521976/referenceerror-domrect-is-not-defined | ||
// globalThis https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis | ||
export function defineDOMRect() { | ||
globalThis.DOMRect = class DOMRect { | ||
x: number = 0; | ||
y: number = 0; | ||
bottom: number = 0; | ||
left: number = 0; | ||
right: number = 0; | ||
top: number = 0; | ||
width: number = 0; | ||
height: number = 0; | ||
constructor( | ||
x: number | undefined = 0, | ||
y: number | undefined = 0, | ||
width: number | undefined = 0, | ||
height: number | undefined = 0 | ||
) { | ||
this.top = x; | ||
this.bottom = y + height; | ||
this.right = x + width; | ||
this.left = x; | ||
this.width = width; | ||
this.height = height; | ||
} | ||
static fromRect(other: DOMRectInit): DOMRect { | ||
return new DOMRect(other.x, other.y, other.width, other.height); | ||
} | ||
toJSON() { | ||
return JSON.stringify(this); | ||
} | ||
}; | ||
} | ||
|
||
export function removeDOMRect() { | ||
delete globalThis.DOMRect; | ||
} |