fix(instructeurs): don't fail when removing all displayed fields

This commit is contained in:
Colin Darie 2024-07-26 15:54:48 +02:00
parent 11208aa6b9
commit 6a6e643771
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
2 changed files with 8 additions and 1 deletions

View file

@ -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))

View file

@ -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