mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-03 22:06:07 +00:00
Remove unwanted space at the end of the price
This `number_to_currency` method seems to display an extra space, not necessary when unit is `''` Strip it. Update specs as well. Thanks @filipefurtad0 for specs!!!
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
= f.text_field :sku, class: 'fullwidth'
|
||||
.field
|
||||
= f.label :price, t('.price')
|
||||
= f.text_field :price, class: 'fullwidth', "ng-model" => "variant.price", "ng-init" => "variant.price = '#{number_to_currency(@variant.price, unit: '')}'"
|
||||
= f.text_field :price, class: 'fullwidth', "ng-model" => "variant.price", "ng-init" => "variant.price = '#{number_to_currency(@variant.price, unit: '').strip}'"
|
||||
.field
|
||||
= hidden_field_tag 'product_variant_unit', @product.variant_unit
|
||||
= hidden_field_tag 'product_variant_unit_name', @product.variant_unit_name
|
||||
@@ -64,4 +64,4 @@
|
||||
- value = number_with_precision(@variant.send(field), precision: 2)
|
||||
= f.number_field field, value: value, class: 'fullwidth', step: 0.01
|
||||
|
||||
.clear
|
||||
.clear
|
||||
|
||||
@@ -208,10 +208,10 @@ describe '
|
||||
page.find('table.index .icon-edit').click
|
||||
|
||||
# assert on the price field
|
||||
expect(page).to have_field "variant_price", with: "19,99 "
|
||||
expect(page).to have_field "variant_price", with: "19,99"
|
||||
|
||||
# When I update the fields and save the variant
|
||||
fill_in "variant_price", with: "12,50 "
|
||||
fill_in "variant_price", with: "12,50"
|
||||
click_button 'Actualizar'
|
||||
expect(page).to have_content \
|
||||
%(Variant "#{product.name}" ha sido actualizado exitosamente)
|
||||
@@ -231,13 +231,9 @@ describe '
|
||||
end
|
||||
|
||||
it_behaves_like "with localization", false, ".", ","
|
||||
it_behaves_like "with localization", true, ".", "," do
|
||||
before { pending("#11085") }
|
||||
end
|
||||
it_behaves_like "with localization", true, ".", ","
|
||||
it_behaves_like "with localization", false, ",", "."
|
||||
it_behaves_like "with localization", true, ",", "." do
|
||||
before { pending("#11085") }
|
||||
end
|
||||
it_behaves_like "with localization", true, ",", "."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user