Commit e32f449b authored by Illya Klymov's avatar Illya Klymov

Merge branch 'vs-use-required-emojis-only-in-specs' into 'master'

Use required emojis only in specs

See merge request gitlab-org/gitlab!40354
parents 3837017c 4fab2f11
......@@ -4,7 +4,6 @@ import MockAdapter from 'axios-mock-adapter';
import { useFakeRequestAnimationFrame } from 'helpers/fake_request_animation_frame';
import axios from '~/lib/utils/axios_utils';
import loadAwardsHandler from '~/awards_handler';
import { setTestTimeout } from './helpers/timeout';
import { EMOJI_VERSION } from '~/emoji';
window.gl = window.gl || {};
......@@ -17,7 +16,44 @@ const urlRoot = gon.relative_url_root;
describe('AwardsHandler', () => {
useFakeRequestAnimationFrame();
const emojiData = getJSONFixture('emojis/emojis.json');
const emojiData = {
'8ball': {
c: 'activity',
e: '🎱',
d: 'billiards',
u: '6.0',
},
grinning: {
c: 'people',
e: '😀',
d: 'grinning face',
u: '6.1',
},
angel: {
c: 'people',
e: '👼',
d: 'baby angel',
u: '6.0',
},
anger: {
c: 'symbols',
e: '💢',
d: 'anger symbol',
u: '6.0',
},
alien: {
c: 'people',
e: '👽',
d: 'extraterrestrial alien',
u: '6.0',
},
sunglasses: {
c: 'people',
e: '😎',
d: 'smiling face with sunglasses',
u: '6.0',
},
};
preloadFixtures('snippets/show.html');
const openAndWaitForEmojiMenu = (sel = '.js-add-award') => {
......@@ -25,7 +61,7 @@ describe('AwardsHandler', () => {
.eq(0)
.click();
jest.advanceTimersByTime(200);
jest.runOnlyPendingTimers();
const $menu = $('.emoji-menu');
......@@ -37,10 +73,6 @@ describe('AwardsHandler', () => {
};
beforeEach(async () => {
// 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);
......
......@@ -10,7 +10,20 @@ jest.mock('~/emoji/support');
describe('gl_emoji', () => {
let mock;
const emojiData = getJSONFixture('emojis/emojis.json');
const emojiData = {
grey_question: {
c: 'symbols',
e: '',
d: 'white question mark ornament',
u: '6.0',
},
bomb: {
c: 'objects',
e: '💣',
d: 'bomb',
u: '6.0',
},
};
beforeAll(() => {
jest.spyOn(EmojiUnicodeSupport, 'default').mockReturnValue(true);
......
......@@ -55,11 +55,10 @@ const emojiFixtureMap = {
describe('gl_emoji', () => {
let mock;
const emojiData = getJSONFixture('emojis/emojis.json');
beforeEach(() => {
mock = new MockAdapter(axios);
mock.onGet(`/-/emojis/${EMOJI_VERSION}/emojis.json`).reply(200, emojiData);
mock.onGet(`/-/emojis/${EMOJI_VERSION}/emojis.json`).reply(200);
return initEmojiMap().catch(() => {});
});
......
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