Mocking JS's withAnimationFrame