From 983e3e717b26415dcc5d9a1dd4c3bc49e566715d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Turbelin?= Date: Sun, 5 Jan 2025 20:08:14 +0100 Subject: [PATCH] Revert "Fix spec" This reverts commit b40e8a1ff9072721c468a7c012e1e4a9d47e3957. --- .../enterprises/form/_permalink.html.haml | 2 ++ .../form/_primary_details.html.haml | 2 +- spec/system/admin/enterprises_spec.rb | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/views/admin/enterprises/form/_permalink.html.haml b/app/views/admin/enterprises/form/_permalink.html.haml index 87c138286a..5c2a43a7b0 100644 --- a/app/views/admin/enterprises/form/_permalink.html.haml +++ b/app/views/admin/enterprises/form/_permalink.html.haml @@ -15,6 +15,8 @@ %span.unavailable.hidden{data: { "permalink-target": "unavailable" }} = t('js.unavailable') %i.icon-remove-sign + + - unless @enterprise.sells == 'none' .row .three.columns.alpha %label= t('.link_to_front') diff --git a/app/views/admin/enterprises/form/_primary_details.html.haml b/app/views/admin/enterprises/form/_primary_details.html.haml index 27965fb421..830cd108b4 100644 --- a/app/views/admin/enterprises/form/_primary_details.html.haml +++ b/app/views/admin/enterprises/form/_primary_details.html.haml @@ -32,4 +32,4 @@ = f.radio_button :visible, "hidden", 'ng-model' => 'Enterprise.visible' = f.label :visible, t('.hidden'), value: 'hidden' -= render partial: 'admin/enterprises/form/permalink' += render partial: 'admin/enterprises/form/permalink' \ No newline at end of file diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index 995b15ae0c..2cd8b23e88 100644 --- a/spec/system/admin/enterprises_spec.rb +++ b/spec/system/admin/enterprises_spec.rb @@ -87,12 +87,12 @@ RSpec.describe ' fill_in 'enterprise_name', with: 'Eaterprises' - accept_alert { click_link "Admin Only" } - choose 'Own' - - accept_alert { click_link "Primary Details" } + accept_alert do + click_link "Admin Only" + end fill_in 'enterprise_permalink', with: 'eaterprises-permalink' expect(page).to have_selector '.available' + choose 'Own' # Require login to view shopfront or for checkout accept_alert do @@ -119,36 +119,34 @@ RSpec.describe ' fill_in_trix_editor 'enterprise_long_description', with: 'This is an interesting long description' + # Check StimulusJs switching of sidebar elements + accept_alert do + click_link "Primary Details" + end + # Unchecking hides the Properties tab - accept_alert { click_link "Primary Details" } uncheck 'enterprise_is_primary_producer' - accept_alert { click_link "Admin Only" } choose 'None' expect(page).not_to have_selector "[data-test=link_for_enterprise_fees]" expect(page).not_to have_selector "[data-test=link_for_payment_methods]" expect(page).not_to have_selector "[data-test=link_for_shipping_methods]" expect(page).not_to have_selector "[data-test=link_for_properties]" # Checking displays the Properties tab - accept_alert { click_link "Primary Details" } check 'enterprise_is_primary_producer' expect(page).to have_selector "[data-test=link_for_enterprise_fees]" expect(page).not_to have_selector "[data-test=link_for_payment_methods]" expect(page).not_to have_selector "[data-test=link_for_shipping_methods]" expect(page).to have_selector "[data-test=link_for_properties]" - accept_alert { click_link "Primary Details" } uncheck 'enterprise_is_primary_producer' - accept_alert { click_link "Admin Only" } choose 'Own' expect(page).to have_selector "[data-test=link_for_enterprise_fees]" expect(page).to have_selector "[data-test=link_for_payment_methods]" expect(page).to have_selector "[data-test=link_for_shipping_methods]" - accept_alert { click_link "Admin Only" } choose 'Any' expect(page).to have_selector "[data-test=link_for_enterprise_fees]" expect(page).to have_selector "[data-test=link_for_payment_methods]" expect(page).to have_selector "[data-test=link_for_shipping_methods]" - accept_alert { click_link "Primary Details" } page.find("#enterprise_group_ids-ts-control").set(eg1.name) page.find("#enterprise_group_ids-ts-dropdown .option.active").click