From fd7f0732fe26554c51218c4f67955e8050590d2c Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Thu, 5 Oct 2017 18:42:34 -0700 Subject: Compress and combine emoji data (#5229) --- spec/javascript/components/emoji_index.test.js | 20 +++++++++++++++++++- spec/javascript/components/emojify.test.js | 11 ++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'spec/javascript') diff --git a/spec/javascript/components/emoji_index.test.js b/spec/javascript/components/emoji_index.test.js index 8c6d2cedb..4bff79265 100644 --- a/spec/javascript/components/emoji_index.test.js +++ b/spec/javascript/components/emoji_index.test.js @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { search } from '../../../app/javascript/mastodon/emoji_index_light'; +import { search } from '../../../app/javascript/mastodon/features/emoji/emoji_mart_search_light'; import { emojiIndex } from 'emoji-mart'; import { pick } from 'lodash'; @@ -78,4 +78,22 @@ describe('emoji_index', () => { expect(emojiIndex.search('flag', { include: ['people'] })) .to.deep.equal([]); }); + + it('does an emoji whose unified name is irregular', () => { + let expected = [{ + 'id': 'water_polo', + 'unified': '1f93d', + 'native': '🤽', + }, { + 'id': 'man-playing-water-polo', + 'unified': '1f93d-200d-2642-fe0f', + 'native': '🤽‍♂️', + }, { + 'id': 'woman-playing-water-polo', + 'unified': '1f93d-200d-2640-fe0f', + 'native': '🤽‍♀️', + }]; + expect(search('polo').map(trimEmojis)).to.deep.equal(expected); + expect(emojiIndex.search('polo').map(trimEmojis)).to.deep.equal(expected); + }); }); diff --git a/spec/javascript/components/emojify.test.js b/spec/javascript/components/emojify.test.js index 4202e52e1..3105c8e3f 100644 --- a/spec/javascript/components/emojify.test.js +++ b/spec/javascript/components/emojify.test.js @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import emojify from '../../../app/javascript/mastodon/emoji'; +import emojify from '../../../app/javascript/mastodon/features/emoji/emoji'; describe('emojify', () => { it('ignores unknown shortcodes', () => { @@ -49,4 +49,13 @@ describe('emojify', () => { expect(emojify('👌🌈💕')).to.equal('👌🌈💕'); expect(emojify('👌 🌈 💕')).to.equal('👌 🌈 💕'); }); + + it('does an emoji that has no shortcode', () => { + expect(emojify('🕉️')).to.equal('🕉️'); + }); + + it('does an emoji whose filename is irregular', () => { + expect(emojify('↙️')).to.equal('↙️'); + }); + }); -- cgit