amelioration(expert/avis/header): passe d'un dropdown avec un element pour telecharger le dossier au composant dsfr de telechargement de fichier

This commit is contained in:
Martin 2023-01-05 10:52:46 +01:00 committed by mfo
parent cd75c7a1de
commit 9a12b97424
3 changed files with 10 additions and 11 deletions

View file

@ -9,11 +9,11 @@
%li= link_to("Dossier nº #{dossier.id}", expert_avis_path(avis.procedure, avis)) %li= link_to("Dossier nº #{dossier.id}", expert_avis_path(avis.procedure, avis))
.header-actions .header-actions
%span.dropdown.print-menu-opener{ data: { controller: 'menu-button' } } .fr-download
%button.button.dropdown-button.icon-only{ data: { menu_button_target: 'button' } } = link_to telecharger_pjs_expert_avis_path(avis.procedure, avis), download: :download, class: "menu-item menu-link fr-download__link" do
%span.icon.attached Télécharger le dossier et toutes ses pièces jointes
%ul.print-menu.dropdown-content#print-pj-menu{ data: { menu_button_target: 'menu' } } %span.fr-download__detail
%li= link_to "Télécharger le dossier et toutes ses pièces jointes", telecharger_pjs_expert_avis_path(avis.procedure, avis), target: "_blank", rel: "noopener", class: "menu-item menu-link" ZIP
%nav.tabs %nav.tabs
%ul %ul

View file

@ -116,7 +116,6 @@ describe 'Inviting an expert:' do
click_on '1 avis à donner' click_on '1 avis à donner'
click_on avis.dossier.user.email click_on avis.dossier.user.email
find(:css, '[aria-controls=print-pj-menu]').click
click_on 'Télécharger le dossier et toutes ses pièces jointes' click_on 'Télécharger le dossier et toutes ses pièces jointes'
# For some reason, clicking the download link does not trigger the download in the headless browser ; # For some reason, clicking the download link does not trigger the download in the headless browser ;
# So we need to go to the download link directly # So we need to go to the download link directly

View file

@ -27,7 +27,7 @@ describe 'users/dossiers/show/header.html.haml', type: :view do
end end
it 'can download the dossier' do it 'can download the dossier' do
expect(rendered).to have_text("Tout le dossier") expect(rendered).to have_selector('a[title="Tout le dossier"]')
end end
end end
@ -45,7 +45,7 @@ describe 'users/dossiers/show/header.html.haml', type: :view do
end end
it 'can download the dossier' do it 'can download the dossier' do
expect(rendered).to have_text("Tout le dossier") expect(rendered).to have_selector('a[title="Tout le dossier"]')
end end
it 'does not display a new procedure link' do it 'does not display a new procedure link' do
@ -68,7 +68,7 @@ describe 'users/dossiers/show/header.html.haml', type: :view do
end end
it 'can download the dossier' do it 'can download the dossier' do
expect(rendered).to have_text("Tout le dossier") expect(rendered).to have_selector('a[title="Tout le dossier"]')
end end
it 'displays a new procedure link' do it 'displays a new procedure link' do
@ -105,7 +105,7 @@ describe 'users/dossiers/show/header.html.haml', type: :view do
end end
it 'can download the dossier' do it 'can download the dossier' do
expect(rendered).to have_text("Tout le dossier") expect(rendered).to have_selector('a[title="Tout le dossier"]')
end end
end end
@ -124,7 +124,7 @@ describe 'users/dossiers/show/header.html.haml', type: :view do
end end
it 'can not download the dossier' do it 'can not download the dossier' do
expect(rendered).not_to have_text("Tout le dossier") expect(rendered).not_to have_selector('a[title="Tout le dossier"]')
end end
end end
end end