Connect unit label to input

And replace redundant spec helper method.
This commit is contained in:
Maikel Linke
2026-02-19 13:10:41 +11:00
parent d770049d2d
commit 702db32595
3 changed files with 2 additions and 12 deletions

View File

@@ -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 },

View File

@@ -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

View File

@@ -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: