diff --git a/app/views/admin/products_v3/_product_row.html.haml b/app/views/admin/products_v3/_product_row.html.haml index 42a062a5ce..9a874d591a 100644 --- a/app/views/admin/products_v3/_product_row.html.haml +++ b/app/views/admin/products_v3/_product_row.html.haml @@ -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 diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index e29328ae04..8b61dbaac3 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -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"