summaryrefslogtreecommitdiff
path: root/spec/javascripts/gl_emoji_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/gl_emoji_spec.js')
-rw-r--r--spec/javascripts/gl_emoji_spec.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/javascripts/gl_emoji_spec.js b/spec/javascripts/gl_emoji_spec.js
index 9b44b25980c..b2b46640e5b 100644
--- a/spec/javascripts/gl_emoji_spec.js
+++ b/spec/javascripts/gl_emoji_spec.js
@@ -43,6 +43,11 @@ const emojiFixtureMap = {
moji: '5️⃣',
unicodeVersion: '3.0',
},
+ grey_question: {
+ name: 'grey_question',
+ moji: '❔',
+ unicodeVersion: '6.0',
+ },
};
function markupToDomElement(markup) {
@@ -153,6 +158,37 @@ describe('gl_emoji', () => {
},
);
});
+
+ it('question mark when invalid emoji name given', () => {
+ const name = 'invalid_emoji';
+ const emojiKey = 'grey_question';
+ const markup = glEmojiTag(name);
+ const glEmojiElement = markupToDomElement(markup);
+ testGlEmojiElement(
+ glEmojiElement,
+ emojiFixtureMap[emojiKey].name,
+ emojiFixtureMap[emojiKey].unicodeVersion,
+ emojiFixtureMap[emojiKey].moji,
+ );
+ });
+
+ it('question mark with image fallback when invalid emoji name given', () => {
+ const name = 'invalid_emoji';
+ const emojiKey = 'grey_question';
+ const markup = glEmojiTag(name, {
+ forceFallback: true,
+ });
+ const glEmojiElement = markupToDomElement(markup);
+ testGlEmojiElement(
+ glEmojiElement,
+ emojiFixtureMap[emojiKey].name,
+ emojiFixtureMap[emojiKey].unicodeVersion,
+ emojiFixtureMap[emojiKey].moji,
+ {
+ forceFallback: true,
+ },
+ );
+ });
});
describe('isFlagEmoji', () => {