DEV: add native lazy loading for emojis (#15830)

This commit is contained in:
Ayke Halder
2022-02-09 12:18:59 +01:00
committed by GitHub
parent b3ecf00c98
commit 5ff3a9c4bb
15 changed files with 85 additions and 78 deletions

View File

@ -55,7 +55,7 @@ describe UserNotificationsHelper do
end
it "doesn't count emoji images" do
with_emoji = "<p>Hi <img src=\"/images/emoji/twitter/smile.png?v=#{Emoji::EMOJI_VERSION}\" title=\":smile:\" class=\"emoji\" alt=\":smile:\"></p>"
with_emoji = "<p>Hi <img src=\"/images/emoji/twitter/smile.png?v=#{Emoji::EMOJI_VERSION}\" title=\":smile:\" class=\"emoji\" alt=\":smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>"
arg = ([with_emoji] + paragraphs).join("\n")
SiteSetting.digest_min_excerpt_length = 50
expect(helper.email_excerpt(arg)).to eq([with_emoji, paragraphs[0]].join)