mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Prevent submitting empty value
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
-# todo: create a method for value_with_description
|
||||
= f.text_field :unit_value_with_description,
|
||||
value: [number_with_precision(variant.unit_value, precision: nil,strip_insignificant_zeros: true), variant.unit_description].compact_blank.join(" "),
|
||||
'aria-label': t('admin.products_page.columns.unit_value')
|
||||
'aria-label': t('admin.products_page.columns.unit_value'), required: true
|
||||
.field
|
||||
= f.label :display_as, t('admin.products_page.columns.display_as')
|
||||
= f.text_field :display_as, placeholder: VariantUnits::OptionValueNamer.new(variant).name
|
||||
|
||||
@@ -192,9 +192,9 @@ describe 'As an admin, I can manage products', feature: :admin_style_v3 do
|
||||
|
||||
# Unit popout
|
||||
# TODO: prevent empty value
|
||||
# fill_in "Unit value", with: ""
|
||||
# click_button "Save changes" # attempt to save or close the popout
|
||||
# expect(page).to have_field "Unit value", with: "" # popout is still open
|
||||
fill_in "Unit value", with: ""
|
||||
click_button "Save changes" # attempt to save or close the popout
|
||||
expect(page).to have_field "Unit value", with: "" # popout is still open
|
||||
fill_in "Unit value", with: "500.1"
|
||||
|
||||
within row_containing_name("Medium box") do
|
||||
|
||||
Reference in New Issue
Block a user