diff --git a/app/forms/settings_form_decorator.rb b/app/forms/settings_form_decorator.rb index 0808a5109b15..d7601d7816f5 100644 --- a/app/forms/settings_form_decorator.rb +++ b/app/forms/settings_form_decorator.rb @@ -121,6 +121,7 @@ def radio_button_group(name:, values: [], disabled: false, button_options: {}, * **button_options.reverse_merge( value:, checked: setting_value(name) == value, + autocomplete: "off", label: setting_label(name, value), caption: setting_caption(name, value) ) diff --git a/spec/features/admin/progress_tracking_spec.rb b/spec/features/admin/progress_tracking_spec.rb index 0024f114ace8..c103592437f8 100644 --- a/spec/features/admin/progress_tracking_spec.rb +++ b/spec/features/admin/progress_tracking_spec.rb @@ -34,10 +34,10 @@ include Toasts::Expectations shared_let(:admin) { create(:admin) } + current_user { admin } it "displays a warning when changing progress calculation mode" do Setting.work_package_done_ratio = "field" - login_as(admin) visit admin_settings_progress_tracking_path # change from work-based to status-based @@ -71,8 +71,6 @@ end it "disables the status closed radio button when changing to status-based" do - login_as(admin) - Setting.work_package_done_ratio = "field" visit admin_settings_progress_tracking_path expect(page).to have_field("No change", disabled: false) @@ -91,4 +89,19 @@ expect(page).to have_field("No change", disabled: true) expect(page).to have_field("Automatically set to 100%", disabled: true) end + + it "does not keep radio button state when navigating to another page and back" do + Setting.work_package_done_ratio = "field" + visit admin_settings_progress_tracking_path + + find(:radio_button, "Status-based").click + + # navigate to another page, then back + click_on "General" + wait_for { page.current_path }.to include(admin_settings_work_packages_general_path) + page.go_back + + # browser should not keep the radio button state (autocomplete="off") + expect(page).to have_field("Work-based", checked: true) + end end