mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-24 01:13:21 +00:00
Connect unit label to input
And replace redundant spec helper method.
This commit is contained in:
@@ -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 },
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user