mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:41:25 +08:00
FIX: allows to have custom emoji translation without static file (#9893)
This commit is contained in:
@ -1040,6 +1040,27 @@ describe PrettyText do
|
||||
end
|
||||
end
|
||||
|
||||
describe "custom emoji translation" do
|
||||
before do
|
||||
PrettyText.reset_translations
|
||||
|
||||
SiteSetting.enable_emoji = true
|
||||
SiteSetting.enable_emoji_shortcuts = true
|
||||
|
||||
plugin = Plugin::Instance.new
|
||||
plugin.translate_emoji "0:)", "otter"
|
||||
end
|
||||
|
||||
after do
|
||||
Plugin::CustomEmoji.clear_cache
|
||||
PrettyText.reset_translations
|
||||
end
|
||||
|
||||
it "sets the custom translation" do
|
||||
expect(PrettyText.cook("hello 0:)")).to match(/otter/)
|
||||
end
|
||||
end
|
||||
|
||||
it "replaces skin toned emoji" do
|
||||
expect(PrettyText.cook("hello 👱🏿♀️")).to eq("<p>hello <img src=\"/images/emoji/twitter/blonde_woman/6.png?v=#{Emoji::EMOJI_VERSION}\" title=\":blonde_woman:t6:\" class=\"emoji\" alt=\":blonde_woman:t6:\"></p>")
|
||||
expect(PrettyText.cook("hello 👩🎤")).to eq("<p>hello <img src=\"/images/emoji/twitter/woman_singer.png?v=#{Emoji::EMOJI_VERSION}\" title=\":woman_singer:\" class=\"emoji\" alt=\":woman_singer:\"></p>")
|
||||
|
Reference in New Issue
Block a user