From 702db32595c77a44a70b5b23abb98c8fbc094079 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 19 Feb 2026 13:10:41 +1100 Subject: [PATCH] Connect unit label to input And replace redundant spec helper method. --- app/views/spree/admin/products/new.html.haml | 2 +- spec/support/tom_select_helper.rb | 10 ---------- spec/system/admin/products_v3/create_spec.rb | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/views/spree/admin/products/new.html.haml b/app/views/spree/admin/products/new.html.haml index b7444422d6..ee6c972d59 100644 --- a/app/views/spree/admin/products/new.html.haml +++ b/app/views/spree/admin/products/new.html.haml @@ -29,7 +29,7 @@ .sixteen.columns.alpha .eight.columns.alpha = f.field_container :variant_unit do - = f.label :variant_unit, t(".units") + = f.label :variant_unit_with_scale, t(".units") %span.required * = f.select 'variant_unit', [], { include_blank: true }, diff --git a/spec/support/tom_select_helper.rb b/spec/support/tom_select_helper.rb index 64fd870426..ab653a4555 100644 --- a/spec/support/tom_select_helper.rb +++ b/spec/support/tom_select_helper.rb @@ -25,16 +25,6 @@ module TomSelectHelper tomselect_wrapper.find(:css, '.ts-dropdown .ts-dropdown-content .option', text: value).click end - def select_tom_select(value, from:) - container = find(:id, from) - - within(container) do - find('.ts-control').send_keys(value) - end - - find('.ts-dropdown .ts-dropdown-content .option', text: /#{Regexp.quote(value)}/i).click - end - def open_tomselect_to_validate!(page, field_name) tomselect_wrapper = page.find_field(field_name).sibling(".ts-wrapper") tomselect_wrapper.find(".ts-control").click # open the dropdown diff --git a/spec/system/admin/products_v3/create_spec.rb b/spec/system/admin/products_v3/create_spec.rb index e36ba0c9fa..965d9f9e99 100644 --- a/spec/system/admin/products_v3/create_spec.rb +++ b/spec/system/admin/products_v3/create_spec.rb @@ -23,7 +23,7 @@ RSpec.describe 'As an enterprise user, I can manage my products' do expect(page).to have_content "New Product" fill_in 'product_name', with: 'Big Bag Of Apples' tomselect_select supplier.name, from: 'product[supplier_id]' - select_tom_select 'Weight (g)', from: 'product_variant_unit_field' + tomselect_search_and_select 'Weight (g)', from: "product_variant_unit_with_scale" fill_in 'product_unit_value', with: '100' fill_in 'product_price', with: '10.00' # TODO dropdowns below are still using select2: