Commit 6fc54299 authored by Paul Slaughter's avatar Paul Slaughter

Remove requestAnimationFrame fallbacks in awards_handler

This function should be available in all supported browsers,
so this complexity isn't needed.

https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36754#note_379942199
parent 90b9f2eb
......@@ -10,7 +10,6 @@ import { isInVueNoteablePage } from './lib/utils/dom_utils';
import flash from './flash';
import axios from './lib/utils/axios_utils';
import * as Emoji from '~/emoji';
import requestAnimationFrame from '~/lib/utils/request_animation_frame_fallback';
const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd';
const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd';
......
/**
* DO NOT USE!
*
* This is a module meant to encapsulate a legacy bit of calculation so that it can
* be easily mocked in Jest to fix performance and degredation issues.
*/
export default window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.setTimeout;
......@@ -5,6 +5,7 @@ import axios from '~/lib/utils/axios_utils';
import loadAwardsHandler from '~/awards_handler';
import { setTestTimeout } from './helpers/timeout';
import { EMOJI_VERSION } from '~/emoji';
import { useFakeRequestAnimationFrame } from 'helpers/fake_request_animation_frame';
window.gl = window.gl || {};
window.gon = window.gon || {};
......@@ -13,9 +14,9 @@ let mock;
let awardsHandler = null;
const urlRoot = gon.relative_url_root;
jest.mock('~/lib/utils/request_animation_frame_fallback', () => cb => cb());
describe('AwardsHandler', () => {
useFakeRequestAnimationFrame();
const emojiData = getJSONFixture('emojis/emojis.json');
preloadFixtures('snippets/show.html');
......@@ -36,7 +37,9 @@ describe('AwardsHandler', () => {
};
beforeEach(async () => {
setTestTimeout(3000);
// These tests have had some timeout issues
// https://gitlab.com/gitlab-org/gitlab/-/issues/221086
setTestTimeout(6000);
mock = new MockAdapter(axios);
mock.onGet(`/-/emojis/${EMOJI_VERSION}/emojis.json`).reply(200, emojiData);
......
// 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;
});
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment