mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 10:01:49 +08:00
FIX: Don't convert :) into Emoji when emojis or emoji shurtcuts are disabled
This commit is contained in:
@ -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