fix tests and linter

This commit is contained in:
Lisa Durand 2023-03-17 11:30:20 +01:00
parent c1b5daadef
commit 4a2982dc37
7 changed files with 27 additions and 20 deletions

View file

@ -1,21 +1,21 @@
%nav.fr-sidemenu{"aria-labelledby" => "fr-sidemenu-title"}
%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" }
.fr-sidemenu__inner
%button.fr-sidemenu__btn{"aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: ""} Dans cette rubrique
%button.fr-sidemenu__btn{ "aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: "" } Dans cette rubrique
#fr-sidemenu-wrapper.fr-collapse
%ul.fr-sidemenu__list
- url = instruction_expert_avis_path(@avis.procedure, @avis)
- current_page = current_page?(url)
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: url, target: "_self"} Donner votre avis
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil, href: url, target: "_self" } Donner votre avis
- if @dossier.avis_for_expert(current_expert).present?
- url = avis_list_expert_avis_path(@avis.procedure, @avis)
- current_page = current_page?(url)
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: url, target: "_self"} Voir les avis
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Voir les avis
- if !@dossier.termine?
- url = avis_new_expert_avis_path(@avis.procedure, @avis)
- current_page = current_page?(url)
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: url, target: "_self"} Demander un nouvel avis
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Demander un nouvel avis

View file

@ -1,14 +1,14 @@
%nav.fr-sidemenu{"aria-labelledby" => "fr-sidemenu-title"}
%nav.fr-sidemenu{ "aria-labelledby" => "fr-sidemenu-title" }
.fr-sidemenu__inner
%button.fr-sidemenu__btn{"aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: ""} Dans cette rubrique
%button.fr-sidemenu__btn{ "aria-controls" => "fr-sidemenu-wrapper", "aria-expanded" => "false", hidden: "" } Dans cette rubrique
#fr-sidemenu-wrapper.fr-collapse
%ul.fr-sidemenu__list
- url = avis_new_instructeur_dossier_path(@dossier.procedure, @dossier)
- current_page = current_page?(url)
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil, href: url, target: "_self"} Demander un avis
- url = avis_instructeur_dossier_path(@dossier.procedure, @dossier)
- current_page = current_page?(url)
%li{class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}"}
%a.fr-sidemenu__link{'aria-current': current_page ? 'page' : nil,href: url, target: "_self"} Voir les avis
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil,href: url, target: "_self" } Voir les avis
- url = avis_new_instructeur_dossier_path(@dossier.procedure, @dossier)
- current_page = current_page?(url)
%li{ class: "fr-sidemenu__item fr-sidemenu__item#{current_page ? '--active' : ''}" }
%a.fr-sidemenu__link{ 'aria-current': current_page ? 'page' : nil, href: url, target: "_self" } Demander un avis

View file

@ -10,6 +10,6 @@
- if @dossier.avis.present?
= render partial: 'instructeurs/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at }
-else
- else
%h2.empty-text Aucun avis.
%p.empty-text-details Aucun avis na été demandé sur ce dossier.

View file

@ -82,7 +82,7 @@ describe Experts::AvisController, type: :controller do
before { get :bilans_bdf, params: { id: avis, procedure_id: } }
it { expect(response).to redirect_to(instructeur_avis_path(avis_without_answer)) }
it { expect(response).to redirect_to(expert_avis_path(avis_without_answer)) }
context 'with a revoked avis' do
let(:avis) { revoked_avis }

View file

@ -189,6 +189,7 @@ describe 'Inviting an expert:' do
click_on avis_1.dossier.user.email
within('.tabs') { click_on 'Avis' }
expect(page).to have_text("Demandeur : #{avis_1.claimant.email}")
click_on 'Voir les avis'
expect(page).to have_text("Vous")
expect(page).to have_text(avis_2.expert.email.to_s)
end
@ -204,6 +205,7 @@ describe 'Inviting an expert:' do
click_on avis_2.dossier.user.email
within('.tabs') { click_on 'Avis' }
expect(page).to have_text("Demandeur : #{avis_2.claimant.email}")
click_on 'Voir les avis'
expect(page).to have_text("Vous")
expect(page).not_to have_text(avis_1.expert.email.to_s)
end

View file

@ -26,13 +26,15 @@ describe 'Inviting an expert:', js: true do
click_on 'Avis externes'
expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier))
within('.fr-sidemenu') { click_on 'Demander un avis' }
expect(page).to have_current_path(avis_new_instructeur_dossier_path(procedure, dossier))
page.execute_script("document.querySelector('#avis_emails').value = '[\"#{expert.email}\",\"#{expert2.email}\"]'")
fill_in 'avis_introduction', with: 'Bonjour, merci de me donner votre avis sur ce dossier.'
check 'avis_invite_linked_dossiers'
page.select 'confidentiel', from: 'avis_confidentiel'
click_on 'Demander un avis'
within('form#new_avis') { click_on 'Demander un avis' }
perform_enqueued_jobs
expect(page).to have_content('Une demande davis a été envoyée')

View file

@ -139,6 +139,8 @@ describe 'Instructing a dossier:', js: true do
click_on 'Avis externes'
expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier))
within('.fr-sidemenu') { click_on 'Demander un avis' }
expect(page).to have_current_path(avis_new_instructeur_dossier_path(procedure, dossier))
expert_email_formated = "[\"expert@tps.com\"]"
expert_email = 'expert@tps.com'
@ -270,6 +272,7 @@ describe 'Instructing a dossier:', js: true do
page.execute_script("document.querySelector('#avis_emails').value = '#{to}'")
fill_in 'avis_introduction', with: introduction
select 'confidentiel', from: 'avis_confidentiel'
within('form#new_avis') { click_on 'Demander un avis' }
click_on 'Demander un avis'
end