Skip to content

Commit

Permalink
test(Effects): Fix fade test with RAF
Browse files Browse the repository at this point in the history
Because of wrong mock implementation
  • Loading branch information
lucaperret committed Aug 11, 2017
1 parent a17c163 commit 8458ca1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/specs/effects.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8458ca1

Please sign in to comment.