mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Add unit name (items) field
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
class: "fullwidth no-input",
|
||||
'aria-label': t('admin.products_page.columns.unit_scale'),
|
||||
data: { "controller": "tom-select", "tom-select-options-value": '{ "plugins": [] }' }
|
||||
= f.text_field :variant_unit_name, 'aria-label': t('items')
|
||||
%td.align-right
|
||||
-# empty
|
||||
%td.align-right
|
||||
|
||||
@@ -236,7 +236,6 @@ describe 'As an admin, I can manage products', feature: :admin_style_v3 do
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content "Changes saved"
|
||||
product_a.reload
|
||||
variant_a1.reload
|
||||
}.to change{ variant_a1.on_demand }.to(true)
|
||||
|
||||
@@ -245,6 +244,26 @@ describe 'As an admin, I can manage products', feature: :admin_style_v3 do
|
||||
end
|
||||
end
|
||||
|
||||
it "saves a custom item unit name" do
|
||||
within row_containing_name("Apples") do
|
||||
tomselect_select "Items", from: "Unit scale"
|
||||
fill_in "Items", with: "box"
|
||||
end
|
||||
|
||||
expect {
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content "Changes saved"
|
||||
product_a.reload
|
||||
}.to change{ product_a.variant_unit }.to("items")
|
||||
.and change{ product_a.variant_unit_name }.to("box")
|
||||
|
||||
within row_containing_name("Apples") do
|
||||
pending
|
||||
expect(page).to have_content "Items (box)"
|
||||
end
|
||||
end
|
||||
|
||||
it "discards changes and reloads latest data" do
|
||||
within row_containing_name("Apples") do
|
||||
fill_in "Name", with: "Pommes"
|
||||
|
||||
Reference in New Issue
Block a user