correctif(a11y): traite aussi les avis d'expert avec la nouvelle methode de rendu des textes saisis par des admin/instructeur/expert

This commit is contained in:
Martin 2023-02-22 11:47:58 +01:00 committed by mfo
parent 8a44e6a03c
commit c00c4936b2
4 changed files with 6 additions and 4 deletions

View file

@ -35,4 +35,4 @@
- if avis.piece_justificative_file.attached?
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
.answer-body
= simple_format(avis.answer)
= render SimpleFormatComponent.new(avis.answer, allow_a: false)

View file

@ -51,4 +51,4 @@
- if avis.piece_justificative_file.attached?
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
.answer-body
= simple_format(avis.answer)
= render SimpleFormatComponent.new(avis.answer, allow_a: false)

View file

@ -63,7 +63,7 @@ describe 'Inviting an expert:', js: true do
click_on 'Avis externes'
expect(page).to have_content(answered_avis.expert.email)
answered_avis.answer.split("\n").each do |answer_line|
answered_avis.answer.split("\n").map { |line| line.gsub("- ", "") }.map do |answer_line|
expect(page).to have_content(answer_line)
end
end

View file

@ -26,7 +26,9 @@ describe 'instructeurs/shared/avis/_list.html.haml', type: :view do
let(:avis) { [create(:avis, :with_answer, claimant: instructeur, experts_procedure: experts_procedure)] }
it 'renders the answer formatted with newlines' do
expect(subject).to include(simple_format(avis.first.answer))
expect(subject).to have_selector(".answer-body p", text: avis.first.answer.split("\n").first)
expect(subject).to have_selector(".answer-body ul", count: 1) # avis.answer has two list item
expect(subject).to have_selector(".answer-body ul li", count: 2)
end
end