Avoid line-break by wrapping into nowrap element

This commit is contained in:
Jean-Baptiste Bellet
2023-06-22 12:25:22 +02:00
parent bfb2fc528e
commit 1cf647e04b
2 changed files with 3 additions and 2 deletions

View File

@@ -28,7 +28,8 @@ module Spree
end
def to_html(options = { html_wrap: true })
@money.format(@options.merge(options)).html_safe
"<span style='white-space: nowrap;'>#{@money.format(@options.merge(options))}</span>"
.html_safe
end
def format(options = {})

View File

@@ -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\">&#x20AC;</span>"
"<span style='white-space: nowrap;'><span class=\"money-whole\">10</span><span class=\"money-decimal-mark\">.</span><span class=\"money-decimal\">00</span> <span class=\"money-currency-symbol\">&#x20AC;</span></span>"
)
end
# rubocop:enable Layout/LineLength