FIX: Respect enable_inline_emoji_translation setting in titles

This commit is contained in:
Gerhard Schlager
2019-12-03 17:32:33 +01:00
parent 86b81b5f63
commit 9ebb69e8eb
8 changed files with 141 additions and 17 deletions
@@ -186,6 +186,27 @@ QUnit.test("Updating the topic title with unicode emojis", async assert => {
);
});
QUnit.test(
"Updating the topic title with unicode emojis without whitespaces",
async assert => {
Discourse.SiteSettings.enable_inline_emoji_translation = true;
await visit("/t/internationalization-localization/280");
await click("#topic-title .d-icon-pencil-alt");
await fillIn("#edit-title", "Test🙂Title");
await click("#topic-title .submit-edit");
assert.equal(
find(".fancy-title")
.html()
.trim(),
`Test<img src="/images/emoji/emoji_one/slightly_smiling_face.png?v=${v}" title="slightly_smiling_face" alt="slightly_smiling_face" class="emoji">Title`,
"it displays the new title with escaped unicode emojis"
);
}
);
acceptance("Topic featured links", {
loggedIn: true,
settings: {
@@ -93,6 +93,8 @@ Discourse.SiteSettingsOriginal = {
enable_emoji: true,
enable_emoji_shortcuts: true,
emoji_set: "emoji_one",
enable_emoji_shortcuts: true,
enable_inline_emoji_translation: false,
desktop_category_page_style: "categories_and_latest_topics",
enable_mentions: true,
enable_personal_messages: true,
+35
View File
@@ -92,6 +92,41 @@ QUnit.test("emojiUnescape", assert => {
"no emoticons when emoji shortcuts are disabled",
{ enable_emoji_shortcuts: false }
);
testUnescape(
"Hello 😊 World",
`Hello <img src='/images/emoji/emoji_one/blush.png?v=${v}' title='blush' alt='blush' class='emoji'> World`,
"emoji from Unicode emoji"
);
testUnescape(
"Hello😊World",
"Hello😊World",
"keeps Unicode emoji when inline translation disabled",
{
enable_inline_emoji_translation: false
}
);
testUnescape(
"Hello😊World",
`Hello<img src='/images/emoji/emoji_one/blush.png?v=${v}' title='blush' alt='blush' class='emoji'>World`,
"emoji from Unicode emoji when inline translation enabled",
{
enable_inline_emoji_translation: true
}
);
testUnescape(
"hi:smile:",
"hi:smile:",
"no emojis when inline translation disabled",
{
enable_inline_emoji_translation: false
}
);
testUnescape(
"hi:smile:",
`hi<img src='/images/emoji/emoji_one/smile.png?v=${v}' title='smile' alt='smile' class='emoji'>`,
"emoji when inline translation enabled",
{ enable_inline_emoji_translation: true }
);
});
QUnit.test("Emoji search", assert => {