FIX: Don't convert :) into Emoji when emojis or emoji shurtcuts are disabled
This commit is contained in:
@@ -91,6 +91,7 @@ Discourse.SiteSettingsOriginal = {
|
||||
highlighted_languages:
|
||||
"apache|bash|cs|cpp|css|coffeescript|diff|xml|http|ini|json|java|javascript|makefile|markdown|nginx|objectivec|ruby|perl|php|python|sql|handlebars",
|
||||
enable_emoji: true,
|
||||
enable_emoji_shortcuts: true,
|
||||
emoji_set: "emoji_one",
|
||||
desktop_category_page_style: "categories_and_latest_topics",
|
||||
enable_mentions: true,
|
||||
|
||||
@@ -5,8 +5,18 @@ import { emojiUnescape } from "discourse/lib/text";
|
||||
QUnit.module("lib:emoji");
|
||||
|
||||
QUnit.test("emojiUnescape", assert => {
|
||||
const testUnescape = (input, expected, description) => {
|
||||
const testUnescape = (input, expected, description, settings = {}) => {
|
||||
const originalSettings = {};
|
||||
for (const [key, value] of Object.entries(settings)) {
|
||||
originalSettings[key] = Discourse.SiteSettings[key];
|
||||
Discourse.SiteSettings[key] = value;
|
||||
}
|
||||
|
||||
assert.equal(emojiUnescape(input), expected, description);
|
||||
|
||||
for (const [key, value] of Object.entries(originalSettings)) {
|
||||
Discourse.SiteSettings[key] = value;
|
||||
}
|
||||
};
|
||||
|
||||
testUnescape(
|
||||
@@ -64,6 +74,24 @@ QUnit.test("emojiUnescape", assert => {
|
||||
"hi :blonde_man:t6",
|
||||
"end colon not optional for skin tones"
|
||||
);
|
||||
testUnescape(
|
||||
"emoticons :)",
|
||||
"emoticons :)",
|
||||
"no emoticons when emojis are disabled",
|
||||
{ enable_emoji: false }
|
||||
);
|
||||
testUnescape(
|
||||
"emoji :smile:",
|
||||
"emoji :smile:",
|
||||
"no emojis when emojis are disabled",
|
||||
{ enable_emoji: false }
|
||||
);
|
||||
testUnescape(
|
||||
"emoticons :)",
|
||||
"emoticons :)",
|
||||
"no emoticons when emoji shortcuts are disabled",
|
||||
{ enable_emoji_shortcuts: false }
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Emoji search", assert => {
|
||||
|
||||
Reference in New Issue
Block a user