From ecca3b3f372f7358b67bba9042af81b83a75ec2f Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 5 May 2017 12:36:33 +0200 Subject: [PATCH 1/2] Add a missing test for _pieces_justificatives.html.haml --- .../_pieces_justificatives.html.haml_spec.rb | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 spec/views/users/description/_pieces_justificatives.html.haml_spec.rb diff --git a/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb new file mode 100644 index 000000000..415f3acd6 --- /dev/null +++ b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe 'users/description/_pieces_justificatives.html.haml', type: :view do + let!(:procedure) { create(:procedure) } + let!(:tpj1) { create(:type_de_piece_justificative, + procedure: procedure, + libelle: "Première pièce jointe", + order_place: 1, + mandatory: true + )} + let!(:tpj2) { create(:type_de_piece_justificative, + procedure: procedure, + libelle: "Seconde pièce jointe", + order_place: 2, + lien_demarche: "https://www.google.fr" + )} + let!(:dossier) { create(:dossier, :procedure => procedure) } + + before do + render 'users/description/pieces_justificatives.html.haml', dossier: dossier + end + + it 'should render two PJ with their title, mandatory status and description' do + expect(rendered).to include("Première pièce jointe *") + expect(rendered).to include("Seconde pièce jointe") + expect(rendered.index("Première pièce jointe")).to be < rendered.index("Seconde pièce jointe") + + expect(rendered).to have_selector("input[type=file]", count: 2) + end +end From 1a5f9fd06778a3f91b0fa755c0f36bf0c421abd7 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 5 May 2017 12:37:11 +0200 Subject: [PATCH 2/2] =?UTF-8?q?[Fix=20#105]=20Show=20the=20pieces=20justif?= =?UTF-8?q?icative=E2=80=99=20descriptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/description.scss | 8 ++++++++ .../users/description/_pieces_justificatives.html.haml | 2 ++ .../description/_pieces_justificatives.html.haml_spec.rb | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/app/assets/stylesheets/description.scss b/app/assets/stylesheets/description.scss index 6ad2f4339..3efa4d01b 100644 --- a/app/assets/stylesheets/description.scss +++ b/app/assets/stylesheets/description.scss @@ -138,3 +138,11 @@ width: 160px; } } + +.piece-description { + display: block; + margin-top: 5px; + margin-bottom: 10px; + color: #737373; + font-weight: normal; +} diff --git a/app/views/users/description/_pieces_justificatives.html.haml b/app/views/users/description/_pieces_justificatives.html.haml index d480fdbf8..75e7054e1 100644 --- a/app/views/users/description/_pieces_justificatives.html.haml +++ b/app/views/users/description/_pieces_justificatives.html.haml @@ -22,6 +22,8 @@ %tr %th.piece-libelle = tpj.mandatory ? tpj.libelle + ' *' : tpj.libelle + %br + .piece-description= tpj.description %td - unless tpj.lien_demarche.blank? diff --git a/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb index 415f3acd6..d0bcacd86 100644 --- a/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb +++ b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb @@ -5,12 +5,14 @@ describe 'users/description/_pieces_justificatives.html.haml', type: :view do let!(:tpj1) { create(:type_de_piece_justificative, procedure: procedure, libelle: "Première pièce jointe", + description: "Première description", order_place: 1, mandatory: true )} let!(:tpj2) { create(:type_de_piece_justificative, procedure: procedure, libelle: "Seconde pièce jointe", + description: "Seconde description", order_place: 2, lien_demarche: "https://www.google.fr" )} @@ -25,6 +27,9 @@ describe 'users/description/_pieces_justificatives.html.haml', type: :view do expect(rendered).to include("Seconde pièce jointe") expect(rendered.index("Première pièce jointe")).to be < rendered.index("Seconde pièce jointe") + expect(rendered).to include("Première description") + expect(rendered).to include("Seconde description") + expect(rendered).to have_selector("input[type=file]", count: 2) end end