Added <p> test for html_mail_client_fixes().

This commit is contained in:
Martin Edenhofer 2016-05-20 14:16:36 +02:00
parent 61a526e3bc
commit c6f09e8867
2 changed files with 15 additions and 5 deletions

View file

@ -241,9 +241,9 @@ Add/change markup to display html in any mail client nice.
def self.html_mail_client_fixes(html) def self.html_mail_client_fixes(html)
# https://github.com/martini/zammad/issues/165 # https://github.com/martini/zammad/issues/165
html.gsub!('<blockquote type="cite">', '<blockquote type="cite" style="border-left: 2px solid blue; margin: 0px; padding: 8px 12px 8px 12px;">') new_html = html.gsub('<blockquote type="cite">', '<blockquote type="cite" style="border-left: 2px solid blue; margin: 0px; padding: 8px 12px 8px 12px;">')
html.gsub('<p>', '<p style="margin: 0;">') new_html.gsub!('<p>', '<p style="margin: 0;">')
new_html
end end
end end

View file

@ -175,7 +175,6 @@ text
text text
</blockquote>' </blockquote>'
html_with_fixes = Channel::EmailBuild.html_mail_client_fixes(html_raw) html_with_fixes = Channel::EmailBuild.html_mail_client_fixes(html_raw)
assert_not_equal(html_with_fixes, html_raw) assert_not_equal(html_with_fixes, html_raw)
html_should = '<blockquote type="cite" style="border-left: 2px solid blue; margin: 0px; padding: 8px 12px 8px 12px;">some html_should = '<blockquote type="cite" style="border-left: 2px solid blue; margin: 0px; padding: 8px 12px 8px 12px;">some
@ -187,9 +186,20 @@ text
<blockquote type="cite" style="border-left: 2px solid blue; margin: 0px; padding: 8px 12px 8px 12px;">some <blockquote type="cite" style="border-left: 2px solid blue; margin: 0px; padding: 8px 12px 8px 12px;">some
text text
</blockquote>' </blockquote>'
assert_equal(html_should, html_with_fixes) assert_equal(html_should, html_with_fixes)
html_raw = '<p>some
text
</p>
<p>123</p>'
html_with_fixes = Channel::EmailBuild.html_mail_client_fixes(html_raw)
assert_not_equal(html_with_fixes, html_raw)
html_should = '<p style="margin: 0;">some
text
</p>
<p style="margin: 0;">123</p>'
assert_equal(html_should, html_with_fixes)
end end
end end