diff options
Diffstat (limited to 'spec/frontend/helpers/fake_request_animation_frame.js')
-rw-r--r-- | spec/frontend/helpers/fake_request_animation_frame.js | 13 |
1 files changed, 13 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..b01ae5b7c5f --- /dev/null +++ b/spec/frontend/helpers/fake_request_animation_frame.js @@ -0,0 +1,13 @@ +// eslint-disable-next-line import/prefer-default-export +export const useFakeRequestAnimationFrame = () => { + let orig; + + beforeEach(() => { + orig = global.requestAnimationFrame; + global.requestAnimationFrame = cb => cb(); + }); + + afterEach(() => { + global.requestAnimationFrame = orig; + }); +}; |