correction after first review

This commit is contained in:
Lisa Durand 2024-10-14 18:07:01 +02:00
parent c0dc487732
commit f68f4c88eb
No known key found for this signature in database
GPG key ID: 0DF91F2CA1E8B816
5 changed files with 50 additions and 5 deletions

View file

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

View file

@ -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('<br>').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])

View file

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

View file

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

View file

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