mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-09 03:20:21 +00:00
Do not modify the HTML returned by Money gem
It was due to these lines that we were returning a broken HTML tag but also, there's no need to remove blanks.
This commit is contained in:
@@ -28,13 +28,7 @@ module Spree
|
||||
end
|
||||
|
||||
def to_html(options = { html_wrap: true })
|
||||
output = @money.format(@options.merge(options))
|
||||
if options[:html_wrap]
|
||||
# 1) prevent blank, breaking spaces
|
||||
# 2) prevent escaping of HTML character entities
|
||||
output = output.sub(" ", " ").html_safe
|
||||
end
|
||||
output
|
||||
@money.format(@options.merge(options)).html_safe
|
||||
end
|
||||
|
||||
def format(options = {})
|
||||
|
||||
@@ -123,7 +123,7 @@ describe Spree::Money do
|
||||
money = Spree::Money.new(10)
|
||||
# The HTMLified version of the euro sign
|
||||
expect(money.to_html).to eq(
|
||||
"<span class=\"money-whole\">10</span><span class=\"money-decimal-mark\">.</span><span class=\"money-decimal\">00</span> <span class=\"money-currency-symbol\">€</span>"
|
||||
"<span class=\"money-whole\">10</span><span class=\"money-decimal-mark\">.</span><span class=\"money-decimal\">00</span> <span class=\"money-currency-symbol\">€</span>"
|
||||
)
|
||||
end
|
||||
# rubocop:enable Layout/LineLength
|
||||
|
||||
Reference in New Issue
Block a user