correctif(usager.depot-dossier): ETQ usager, les titres de section conditionnés etait visible meme si la condition n'etait pas remplie
This commit is contained in:
parent
4d860aff9a
commit
8c78008b4d
3 changed files with 11 additions and 5 deletions
|
@ -12,10 +12,11 @@ class EditableChamp::HeaderSectionComponent < ApplicationComponent
|
|||
end
|
||||
|
||||
def header_section_classnames
|
||||
class_names = ["fr-h#{level}"]
|
||||
|
||||
class_names << 'header-section' if @champ.dossier.auto_numbering_section_headers_for?(@champ)
|
||||
class_names
|
||||
class_names(
|
||||
"fr-h#{level}": true,
|
||||
'header-section': @champ.dossier.auto_numbering_section_headers_for?(@champ),
|
||||
'hidden': !@champ.visible?
|
||||
)
|
||||
end
|
||||
|
||||
def tag_for_depth
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
= tag.send(tag_for_depth, class: header_section_classnames) do
|
||||
= tag.send(tag_for_depth, class: header_section_classnames, id: @champ.input_group_id) do
|
||||
= libelle
|
||||
|
|
|
@ -406,6 +406,7 @@ describe 'The user' do
|
|||
types_de_champ_public: [
|
||||
{ type: :integer_number, libelle: 'age', stable_id: age_stable_id },
|
||||
{ type: :yes_no, libelle: 'permis de conduire', stable_id: permis_stable_id, condition: permis_condition },
|
||||
{ type: :header_section, libelle: 'info voiture', condition: permis_condition },
|
||||
{ type: :integer_number, libelle: 'tonnage', stable_id: tonnage_stable_id, condition: tonnage_condition },
|
||||
{ type: :text, libelle: 'parking', condition: parking_condition }
|
||||
])
|
||||
|
@ -418,16 +419,20 @@ describe 'The user' do
|
|||
|
||||
expect(page).to have_css('label', text: 'age', visible: true)
|
||||
expect(page).to have_no_css('label', text: 'permis de conduire', visible: true)
|
||||
expect(page).to have_no_css('legend h2', text: 'info voiture', visible: true)
|
||||
expect(page).to have_no_css('label', text: 'tonnage', visible: true)
|
||||
|
||||
fill_in('age', with: '18')
|
||||
expect(page).to have_css('label', text: 'permis de conduire', visible: true)
|
||||
expect(page).to have_css('legend h2', text: 'info voiture', visible: true)
|
||||
expect(page).to have_no_css('label', text: 'tonnage', visible: true)
|
||||
|
||||
|
||||
choose('Oui')
|
||||
expect(page).to have_css('label', text: 'permis de conduire', visible: true)
|
||||
expect(page).to have_css('label', text: 'tonnage', visible: true)
|
||||
|
||||
|
||||
fill_in('tonnage', with: '1')
|
||||
expect(page).to have_css('label', text: 'parking', visible: true)
|
||||
|
||||
|
|
Loading…
Reference in a new issue