Merge pull request #3266 from betagouv/fix-textareas
Corrige l'affichage des textsareas dans les demandes
This commit is contained in:
commit
3e149e7c8e
2 changed files with 18 additions and 10 deletions
|
@ -22,7 +22,7 @@
|
|||
- when TypeDeChamp.type_champs.fetch(:siret)
|
||||
= render partial: "shared/champs/siret/show", locals: { champ: c, profile: profile }
|
||||
- when TypeDeChamp.type_champs.fetch(:textarea)
|
||||
= render partial: "shared/champs/text_area/show", locals: { champ: c }
|
||||
= render partial: "shared/champs/textarea/show", locals: { champ: c }
|
||||
- else
|
||||
= sanitize(c.to_s)
|
||||
|
||||
|
|
|
@ -17,21 +17,29 @@ describe 'shared/dossiers/champs.html.haml', type: :view do
|
|||
let(:champ2) { create(:champ, :header_section, value: "Section") }
|
||||
let(:champ3) { create(:champ, :explication, value: "mazette") }
|
||||
let(:champ4) { create(:champ, :dossier_link, value: dossier.id) }
|
||||
let(:champs) { [champ1, champ2, champ3, champ4] }
|
||||
let(:champ5) { create(:champ_textarea, value: "Some long text in a textarea.") }
|
||||
let(:champs) { [champ1, champ2, champ3, champ4, champ5] }
|
||||
|
||||
before { dossier.avis << avis }
|
||||
|
||||
it { is_expected.to include(champ1.libelle) }
|
||||
it { is_expected.to include(champ1.value) }
|
||||
it "renders titles and values of champs" do
|
||||
expect(subject).to include(champ1.libelle)
|
||||
expect(subject).to include(champ1.value)
|
||||
|
||||
it { is_expected.to have_css(".header-section") }
|
||||
it { is_expected.to include(champ2.libelle) }
|
||||
expect(subject).to have_css(".header-section")
|
||||
expect(subject).to include(champ2.libelle)
|
||||
|
||||
it { is_expected.not_to include(champ3.libelle) }
|
||||
it { is_expected.not_to include(champ3.value) }
|
||||
expect(subject).to have_link("Dossier nº #{dossier.id}")
|
||||
expect(subject).to include(dossier.text_summary)
|
||||
|
||||
it { is_expected.to have_link("Dossier nº #{dossier.id}") }
|
||||
it { is_expected.to include(dossier.text_summary) }
|
||||
expect(subject).to include(champ5.libelle)
|
||||
expect(subject).to include(champ5.libelle)
|
||||
end
|
||||
|
||||
it "doesn't render explication champs" do
|
||||
expect(subject).not_to include(champ3.libelle)
|
||||
expect(subject).not_to include(champ3.value)
|
||||
end
|
||||
end
|
||||
|
||||
context "with a dossier champ, but we are not authorized to acces the dossier" do
|
||||
|
|
Loading…
Reference in a new issue