From cf44458bbfd95b6e411c76ecbc0528f64ad9f5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 27 Apr 2021 14:07:20 +0100 Subject: [PATCH] fix(tests): update tests for react-cool-dimensions 2.0.3 --- ui/src/Components/Grid/AlertGrid/index.test.tsx | 5 +++++ ui/src/Components/NavBar/index.test.tsx | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ui/src/Components/Grid/AlertGrid/index.test.tsx b/ui/src/Components/Grid/AlertGrid/index.test.tsx index 4548c9c3a..211c63637 100644 --- a/ui/src/Components/Grid/AlertGrid/index.test.tsx +++ b/ui/src/Components/Grid/AlertGrid/index.test.tsx @@ -35,6 +35,11 @@ beforeEach(() => { window.matchMedia = mockMatchMedia({}); + window.requestAnimationFrame = (cb: FrameRequestCallback) => { + cb(0); + return 0; + }; + jest.spyOn(React, "useContext").mockImplementation(() => MockThemeContext); Object.defineProperty(document.body, "clientWidth", { diff --git a/ui/src/Components/NavBar/index.test.tsx b/ui/src/Components/NavBar/index.test.tsx index a749fefd4..b1fb8ded9 100644 --- a/ui/src/Components/NavBar/index.test.tsx +++ b/ui/src/Components/NavBar/index.test.tsx @@ -35,6 +35,11 @@ beforeEach(() => { // fix startsAt & endsAt dates so they don't change between tests silenceFormStore.data.setStart(new Date(Date.UTC(2018, 1, 30, 10, 25, 50))); silenceFormStore.data.setEnd(new Date(Date.UTC(2018, 1, 30, 11, 25, 50))); + + jest.spyOn(window, "requestAnimationFrame").mockImplementation((cb) => { + cb(0); + return 0; + }); }); afterEach(() => {