diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb index c61b19aa4..6de8cfdee 100644 --- a/app/controllers/instructeurs/procedures_controller.rb +++ b/app/controllers/instructeurs/procedures_controller.rb @@ -134,7 +134,8 @@ module Instructeurs end def update_displayed_fields - values = params['values'].presence || [] + values = (params['values'].presence || []).reject(&:empty?) + procedure_presentation.update_displayed_fields(values) redirect_back(fallback_location: instructeur_procedure_url(procedure)) diff --git a/spec/system/instructeurs/procedure_filters_spec.rb b/spec/system/instructeurs/procedure_filters_spec.rb index 846d425e5..3a0b8c678 100644 --- a/spec/system/instructeurs/procedure_filters_spec.rb +++ b/spec/system/instructeurs/procedure_filters_spec.rb @@ -60,6 +60,12 @@ describe "procedure filters" do expect(page).not_to have_link(type_de_champ.libelle) expect(page).not_to have_link(champ.value) end + + # Test removal of all customizable fields + remove_column("Demandeur") + within ".dossiers-table" do + expect(page).not_to have_link("Demandeur") + end end scenario "should be able to add and remove filter", js: true do