types: fix to prop typing (#8134)

This commit is contained in:
neverland
2021-02-11 12:34:25 +08:00
committed by GitHub
parent 1019463e89
commit 7a5fb894d2
3 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -37,10 +37,10 @@ export function mockScrollIntoView() {
return fn;
}
export function mockGetBoundingClientRect(rect: DOMRect): () => void {
export function mockGetBoundingClientRect(rect: Partial<DOMRect>): () => void {
const originMethod = Element.prototype.getBoundingClientRect;
Element.prototype.getBoundingClientRect = jest.fn(() => rect);
Element.prototype.getBoundingClientRect = jest.fn(() => rect as DOMRect);
return function () {
Element.prototype.getBoundingClientRect = originMethod;