瀏覽代碼

Fix multipoint shortcode bug (#4387)

* Fix multipoint shortcode bug

* Added testcase for composite emoji shortcode
master
Ondřej Hruška 6 年之前
committed by Eugen Rochko
父節點
當前提交
f49339ca9c
共有 2 個檔案被更改,包括 6 行新增1 行删除
  1. +1
    -1
      app/lib/emoji.rb
  2. +5
    -0
      spec/helpers/emoji_helper_spec.rb

+ 1
- 1
app/lib/emoji.rb 查看文件

@@ -32,7 +32,7 @@ class Emoji

def codepoint_to_unicode(codepoint)
if codepoint.include?('-')
codepoint.split('-').map(&:hex).pack('U')
codepoint.split('-').map(&:hex).pack('U*')
else
[codepoint.hex].pack('U')
end


+ 5
- 0
spec/helpers/emoji_helper_spec.rb 查看文件

@@ -7,6 +7,11 @@ RSpec.describe EmojiHelper, type: :helper do
expect(emojify(text)).to eq '📖 Book'
end

it 'converts composite emoji shortcodes to unicode' do
text = ':couple_ww:'
expect(emojify(text)).to eq '👩❤👩'
end

it 'does not convert shortcodes that are part of a string into unicode' do
text = ':see_no_evil::hear_no_evil::speak_no_evil:'
expect(emojify(text)).to eq text


Loading…
取消
儲存