summaryrefslogtreecommitdiff
path: root/spec/frontend/__helpers__/fake_request_animation_frame.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/__helpers__/fake_request_animation_frame.js')
-rw-r--r--spec/frontend/__helpers__/fake_request_animation_frame.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/frontend/__helpers__/fake_request_animation_frame.js b/spec/frontend/__helpers__/fake_request_animation_frame.js
new file mode 100644
index 00000000000..ca9d82b6c3a
--- /dev/null
+++ b/spec/frontend/__helpers__/fake_request_animation_frame.js
@@ -0,0 +1,12 @@
+export const useFakeRequestAnimationFrame = () => {
+ let orig;
+
+ beforeEach(() => {
+ orig = global.requestAnimationFrame;
+ global.requestAnimationFrame = (cb) => cb();
+ });
+
+ afterEach(() => {
+ global.requestAnimationFrame = orig;
+ });
+};