From 76c9f38fb6d17c9c5a5f46e55bec3dd47956939b Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Thu, 30 Sep 2021 12:27:35 +0100 Subject: [PATCH] Fix display of "inventory only" radio buttons Previously the two radio buttons were not showing which option was set; both options were blank even if one had been selected. --- .../admin/enterprises/form/_inventory_settings.html.haml | 4 ++-- spec/features/admin/enterprises_spec.rb | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/admin/enterprises/form/_inventory_settings.html.haml b/app/views/admin/enterprises/form/_inventory_settings.html.haml index c055a1231fc..d9b41295bd8 100644 --- a/app/views/admin/enterprises/form/_inventory_settings.html.haml +++ b/app/views/admin/enterprises/form/_inventory_settings.html.haml @@ -12,8 +12,8 @@ .row .alpha.eleven.columns .five.columns.alpha - = radio_button :enterprise, :preferred_product_selection_from_inventory_only, "0", { 'ng-model' => 'Enterprise.preferred_product_selection_from_inventory_only' } + = radio_button :enterprise, :preferred_product_selection_from_inventory_only, false = label :enterprise, :preferred_product_selection_from_inventory_only, t('.preferred_product_selection_from_inventory_only_yes') .six.columns.omega - = radio_button :enterprise, :preferred_product_selection_from_inventory_only, "1", { 'ng-model' => 'Enterprise.preferred_product_selection_from_inventory_only' } + = radio_button :enterprise, :preferred_product_selection_from_inventory_only, true = label :enterprise, :preferred_product_selection_from_inventory_only, t('.preferred_product_selection_from_inventory_only_no') diff --git a/spec/features/admin/enterprises_spec.rb b/spec/features/admin/enterprises_spec.rb index 360a751e0a4..ba51a6dea0b 100644 --- a/spec/features/admin/enterprises_spec.rb +++ b/spec/features/admin/enterprises_spec.rb @@ -183,6 +183,11 @@ choose "enterprise_preferred_shopfront_order_cycle_order_orders_open_at" choose "enterprise_enable_subscriptions_true" + accept_alert do + click_link "Inventory Settings" + end + expect(page).to have_checked_field "enterprise_preferred_product_selection_from_inventory_only_false" + click_button 'Update' expect(flash_message).to eq('Enterprise "Eaterprises" has been successfully updated!')