From 8458ca15bf929710cdfc5f0667690a22fe1ce40b Mon Sep 17 00:00:00 2001 From: Luca Perret Date: Fri, 11 Aug 2017 23:02:36 +0200 Subject: [PATCH] test(Effects): Fix fade test with RAF Because of wrong mock implementation --- test/specs/effects.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/specs/effects.spec.js b/test/specs/effects.spec.js index 717a6cb..c5ce7ca 100644 --- a/test/specs/effects.spec.js +++ b/test/specs/effects.spec.js @@ -21,14 +21,14 @@ describe('Effects', () => { expect(Number(element.style.opacity)).toBeGreaterThanOrEqual(1) }) test('RAF fade in', () => { - window.requestAnimationFrame = jest.fn(fn => setTimeout(fn, 1)) + global.requestAnimationFrame = jest.fn() effects.fadeIn(element, 1) jest.runAllTimers() - expect(window.requestAnimationFrame).toBeCalled() + expect(global.requestAnimationFrame).toBeCalled() effects.fadeIn(element) jest.runAllTimers() - expect(window.requestAnimationFrame).toBeCalled() - delete window.requestAnimationFrame + expect(global.requestAnimationFrame).toBeCalled() + delete global.requestAnimationFrame }) test('Fade out', () => { element.style.opacity = 0