FEATURE: Add email dark mode (#16104)

implement dark mode emails when `SiteSetting.dark_mode_emails_active` is active.
This commit is contained in:
Isaac Janzen
2022-04-11 12:27:50 -05:00
committed by GitHub
parent a0ef25f4f0
commit 6c0abe15e0
9 changed files with 104 additions and 8 deletions

View File

@ -156,6 +156,23 @@ describe Email::Styles do
end
context "dark mode emails" do
before do
SiteSetting.dark_mode_emails_active = true
end
it "adds dark_mode_styles when site setting active" do
frag = html_fragment('<div class="body">test</div>')
styler = Email::Styles.new(frag)
styler.format_basic
styler.format_html
@frag = Nokogiri::HTML5.fragment(styler.to_s)
# dark mode attribute
expect(@frag.css('[dm="body"]')).to be_present
end
end
context "strip_avatars_and_emojis" do
it "works for lonesome emoji with no title" do
emoji = "<img src='/images/emoji/twitter/crying_cat_face.png'>"