mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Keep HTML line breaks
They do appear in long_description on au_prod.
This commit is contained in:
@@ -9,7 +9,7 @@ class HtmlSanitizer
|
||||
def self.sanitize(html)
|
||||
@sanitizer ||= Rails::HTML5::SafeListSanitizer.new
|
||||
@sanitizer.sanitize(
|
||||
html, tags: %w[h1 h2 h3 h4 p b i u a], attributes: %w[href target],
|
||||
html, tags: %w[h1 h2 h3 h4 p br b i u a], attributes: %w[href target],
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,9 +12,9 @@ RSpec.describe HtmlSanitizer do
|
||||
end
|
||||
|
||||
it "keeps supported tags" do
|
||||
html = "Hello <b>alert</b>!"
|
||||
html = "Hello <b>alert</b>! <br>How are you?"
|
||||
expect(subject.sanitize(html))
|
||||
.to eq "Hello <b>alert</b>!"
|
||||
.to eq "Hello <b>alert</b>! <br>How are you?"
|
||||
end
|
||||
|
||||
it "keeps supported attributes" do
|
||||
|
||||
Reference in New Issue
Block a user