mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
[OFN-9834] Fix red error highlighting on product unit value label
[OFN-9834] Fix unit value form label association [OFN-9834] Update tests to reference correct product unit 'Value' field id
This commit is contained in:
@@ -32,9 +32,9 @@
|
||||
= f.error_message_on :variant_unit
|
||||
.two.columns
|
||||
= f.field_container :unit_value do
|
||||
= f.label :unit_value_with_description, t(".value"), 'ng-disabled' => "!hasUnit(product)"
|
||||
= f.label :unit_value, t(".value"), 'ng-disabled' => "!hasUnit(product)"
|
||||
%span.required *
|
||||
%input.fullwidth{ id: 'product_unit_value_with_description', 'ng-model' => 'product.master.unit_value_with_description', :type => 'text', placeholder: "eg. 2", 'ng-disabled' => "!hasUnit(product)" }
|
||||
%input.fullwidth{ id: 'product_unit_value', 'ng-model' => 'product.master.unit_value_with_description', :type => 'text', placeholder: "eg. 2", 'ng-disabled' => "!hasUnit(product)" }
|
||||
%input{ type: 'hidden', 'ng-value': 'product.master.unit_value', "ng-init": "product.master.unit_value='#{@product.master.unit_value}'", name: 'product[unit_value]' }
|
||||
%input{ type: 'hidden', 'ng-value': 'product.master.unit_description', "ng-init": "product.master.unit_description='#{@product.master.unit_description}'", name: 'product[unit_description]' }
|
||||
= f.error_message_on :unit_value
|
||||
|
||||
@@ -216,7 +216,7 @@ describe '
|
||||
fill_in 'product_name', with: 'Big Bag Of Apples'
|
||||
select supplier.name, from: 'product_supplier_id'
|
||||
select 'Weight (g)', from: 'product_variant_unit_with_scale'
|
||||
fill_in 'product_unit_value_with_description', with: '100'
|
||||
fill_in 'product_unit_value', with: '100'
|
||||
fill_in 'product_price', with: '10.00'
|
||||
select taxon.name, from: 'product_primary_taxon_id'
|
||||
select shipping_category.name, from: 'product_shipping_category_id'
|
||||
@@ -828,7 +828,7 @@ describe '
|
||||
fill_in 'product_name', with: 'Big Bag Of Apples'
|
||||
select supplier_permitted.name, from: 'product_supplier_id'
|
||||
select 'Weight (g)', from: 'product_variant_unit_with_scale'
|
||||
fill_in 'product_unit_value_with_description', with: '100'
|
||||
fill_in 'product_unit_value', with: '100'
|
||||
fill_in 'product_price', with: '10.00'
|
||||
select taxon.name, from: 'product_primary_taxon_id'
|
||||
select shipping_category.name, from: 'product_shipping_category_id'
|
||||
|
||||
@@ -37,7 +37,7 @@ describe '
|
||||
|
||||
select @supplier.name, from: 'product_supplier_id'
|
||||
select "Weight (kg)", from: 'product_variant_unit_with_scale'
|
||||
fill_in 'product_unit_value_with_description', with: "5.00 g"
|
||||
fill_in 'product_unit_value', with: "5.00 g"
|
||||
assert_selector(:field, placeholder: "5kg g")
|
||||
fill_in 'product_display_as', with: "Big Box of Chocolates"
|
||||
select taxon.name, from: "product_primary_taxon_id"
|
||||
@@ -51,7 +51,7 @@ describe '
|
||||
|
||||
expect(page).to have_content "Name can't be blank"
|
||||
expect(page).to have_field 'product_supplier_id', with: @supplier.id
|
||||
expect(page).to have_field 'product_unit_value_with_description', with: "5.00 g"
|
||||
expect(page).to have_field 'product_unit_value', with: "5.00 g"
|
||||
expect(page).to have_field 'product_display_as', with: "Big Box of Chocolates"
|
||||
expect(page).to have_field 'product_primary_taxon_id', with: taxon.id
|
||||
expect(page).to have_field 'product_price', with: '19.99'
|
||||
@@ -75,7 +75,7 @@ describe '
|
||||
select 'New supplier', from: 'product_supplier_id'
|
||||
fill_in 'product_name', with: 'A new product !!!'
|
||||
select "Weight (kg)", from: 'product_variant_unit_with_scale'
|
||||
fill_in 'product_unit_value_with_description', with: 5
|
||||
fill_in 'product_unit_value', with: 5
|
||||
select taxon.name, from: "product_primary_taxon_id"
|
||||
fill_in 'product_price', with: '19.99'
|
||||
fill_in 'product_on_hand', with: 5
|
||||
@@ -112,7 +112,7 @@ describe '
|
||||
fill_in 'product_name', with: 'Hot Cakes'
|
||||
select 'New supplier', from: 'product_supplier_id'
|
||||
select "Weight (kg)", from: 'product_variant_unit_with_scale'
|
||||
fill_in 'product_unit_value_with_description', with: 1
|
||||
fill_in 'product_unit_value', with: 1
|
||||
select taxon.name, from: "product_primary_taxon_id"
|
||||
fill_in 'product_price', with: '1.99'
|
||||
fill_in 'product_on_hand', with: 0
|
||||
@@ -137,7 +137,7 @@ describe '
|
||||
fill_in 'product_name', with: 'Hot Cakes'
|
||||
select 'New supplier', from: 'product_supplier_id'
|
||||
select "Weight (kg)", from: 'product_variant_unit_with_scale'
|
||||
fill_in "product_unit_value_with_description", with: ""
|
||||
fill_in "product_unit_value", with: ""
|
||||
select taxon.name, from: "product_primary_taxon_id"
|
||||
fill_in 'product_price', with: '1.99'
|
||||
fill_in 'product_on_hand', with: 0
|
||||
@@ -251,7 +251,7 @@ describe '
|
||||
expect(page).to have_selector('#product_supplier_id')
|
||||
select 'Another Supplier', from: 'product_supplier_id'
|
||||
select 'Weight (g)', from: 'product_variant_unit_with_scale'
|
||||
fill_in 'product_unit_value_with_description', with: '500'
|
||||
fill_in 'product_unit_value', with: '500'
|
||||
select taxon.name, from: "product_primary_taxon_id"
|
||||
select 'None', from: "product_tax_category_id"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user