diff --git a/app/views/admin/products_v3/_variant_row.html.haml b/app/views/admin/products_v3/_variant_row.html.haml index 77af4ee424..97646ec1ba 100644 --- a/app/views/admin/products_v3/_variant_row.html.haml +++ b/app/views/admin/products_v3/_variant_row.html.haml @@ -44,7 +44,7 @@ %td.align-left .content= variant.primary_taxon&.name %td.align-left - .content= variant.tax_category&.name || "None" # TODO: convert to dropdown, else translate hardcoded string. + .content= (variant.tax_category_id ? variant.tax_category&.name : t('.none_tax_category')) # TODO: convert to dropdown %td.align-left -# empty %td.align-right diff --git a/config/locales/en.yml b/config/locales/en.yml index 2777dab7ad..e20236b1d9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -907,6 +907,8 @@ en: delete_variant: success: Successfully deleted the variant error: Unable to delete the variant + variant_row: + none_tax_category: None product_import: title: Product Import file_not_found: File not found or could not be opened diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 6581ddc657..7384f1c0bd 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -507,6 +507,7 @@ describe 'As an admin, I can manage products', feature: :admin_style_v3 do expect(new_variant.price).to eq 10.25 expect(new_variant.unit_value).to eq 1000 expect(new_variant.on_hand).to eq 3 + expect(new_variant.tax_category_id).to be_nil within row_containing_name("Large box") do expect(page).to have_field "Name", with: "Large box" @@ -514,6 +515,9 @@ describe 'As an admin, I can manage products', feature: :admin_style_v3 do expect(page).to have_field "Price", with: "10.25" expect(page).to have_content "1kg" expect(page).to have_button "On Hand", text: "3" + within tax_category_column do + expect(page).to have_content "None" + end end end @@ -1019,4 +1023,8 @@ describe 'As an admin, I can manage products', feature: :admin_style_v3 do def expect_page_to_have_image(url) expect(page).to have_selector("img[src$='#{url}']") end + + def tax_category_column + @tax_category_column ||= 'td:nth-child(10)' + end end