diff --git a/app/assets/stylesheets/dsfr.scss b/app/assets/stylesheets/dsfr.scss index 95e6e0060..fb1ecc189 100644 --- a/app/assets/stylesheets/dsfr.scss +++ b/app/assets/stylesheets/dsfr.scss @@ -267,3 +267,8 @@ button.fr-tag-bug { .fr-tag { white-space: nowrap; } + +// We remove the line height because it creates unharmonized spaces - most of all in table +.fr-tags-group > li { + line-height: inherit; +} diff --git a/app/helpers/dossier_helper.rb b/app/helpers/dossier_helper.rb index 54364c8ad..e2047738a 100644 --- a/app/helpers/dossier_helper.rb +++ b/app/helpers/dossier_helper.rb @@ -120,7 +120,7 @@ module DossierHelper def tags_label(tags) if tags.count > 1 - tag.div(tags.map { tag_label(_1[1], _1[2]) }.join('
').html_safe, class: 'fr-tags-group') + tag.ul(tags.map { tag.li(tag_label(_1[1], _1[2])) }.join.html_safe, class: 'fr-tags-group') else tag = tags.first tag_label(tag[1], tag[2]) diff --git a/spec/controllers/instructeurs/dossiers_controller_spec.rb b/spec/controllers/instructeurs/dossiers_controller_spec.rb index a035aa8c2..45ffa7b32 100644 --- a/spec/controllers/instructeurs/dossiers_controller_spec.rb +++ b/spec/controllers/instructeurs/dossiers_controller_spec.rb @@ -1527,9 +1527,9 @@ describe Instructeurs::DossiersController, type: :controller do dossier.reload expect(dossier.dossier_labels.count).to eq(1) + expect(subject.body).to include('fr-tag--brown-caramel') + expect(subject.body).not_to include('Ajouter un label') end - - it { expect(subject.body).to include('header-top') } end context 'it remove dossier labels' do @@ -1546,9 +1546,8 @@ describe Instructeurs::DossiersController, type: :controller do dossier.reload expect(dossier.dossier_labels.count).to eq(0) + expect(subject.body).to include('Ajouter un label') end - - it { expect(subject.body).to include('header-top') } end end end diff --git a/spec/controllers/instructeurs/procedures_controller_spec.rb b/spec/controllers/instructeurs/procedures_controller_spec.rb index 1f3ea9acb..20c14a6a0 100644 --- a/spec/controllers/instructeurs/procedures_controller_spec.rb +++ b/spec/controllers/instructeurs/procedures_controller_spec.rb @@ -637,6 +637,37 @@ describe Instructeurs::ProceduresController, type: :controller do it { expect(assigns(:last_export)).to eq(nil) } end end + + context 'dossier labels' do + let!(:dossier) { create(:dossier, :en_construction, groupe_instructeur: gi_2) } + let!(:dossier_2) { create(:dossier, :en_construction, groupe_instructeur: gi_2) } + let(:statut) { 'tous' } + let(:procedure_label_id) { procedure.find_column(label: 'Labels') } + let!(:procedure_presentation) do + ProcedurePresentation.create!(assign_to: AssignTo.first) + end + render_views + + before do + DossierLabel.create(dossier_id: dossier.id, procedure_label_id: dossier.procedure.procedure_labels.first.id) + DossierLabel.create(dossier_id: dossier.id, procedure_label_id: dossier.procedure.procedure_labels.second.id) + DossierLabel.create(dossier_id: dossier_2.id, procedure_label_id: dossier.procedure.procedure_labels.last.id) + + procedure_presentation.update(displayed_columns: [ + procedure_label_id.id + ]) + + subject + end + + it 'displays correctly labels in instructeur table' do + expect(response.body).to include("Labels") + expect(response.body).to have_selector('ul.fr-tags-group li span.fr-tag', text: 'à relancer') + expect(response.body).to have_selector('ul.fr-tags-group li span.fr-tag', text: 'complet') + expect(response.body).not_to have_selector('ul li span.fr-tag', text: 'prêt pour validation') + expect(response.body).to have_selector('span.fr-tag', text: 'prêt pour validation') + end + end end end diff --git a/spec/system/instructeurs/procedure_filters_spec.rb b/spec/system/instructeurs/procedure_filters_spec.rb index c105775f4..9dc278194 100644 --- a/spec/system/instructeurs/procedure_filters_spec.rb +++ b/spec/system/instructeurs/procedure_filters_spec.rb @@ -94,6 +94,7 @@ describe "procedure filters" do expect(page).to have_link(new_unfollow_dossier_2.user.email) end end + describe 'with dropdown' do let(:types_de_champ_public) { [{ type: :drop_down_list }] } @@ -171,6 +172,15 @@ describe "procedure filters" do end end + describe 'dossier labels' do + scenario "should be able to filter by dossier labels", js: true do + DossierLabel.create!(dossier_id: new_unfollow_dossier.id, procedure_label_id: procedure.procedure_labels.first.id) + add_filter('Labels', procedure.procedure_labels.first.name, type: :enum) + expect(page).to have_link(new_unfollow_dossier.id.to_s) + expect(page).not_to have_link(new_unfollow_dossier_2.id.to_s) + end + end + scenario "should be able to add and remove two filters for the same field", js: true do add_filter(type_de_champ.libelle, champ.value) add_filter(type_de_champ.libelle, champ_2.value)