Skip to content

Commit

Permalink
fix linked_drop_down_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
maatinito committed Aug 28, 2023
1 parent 8b33a31 commit 10f7cba
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions spec/system/users/linked_dropdown_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
'Secondary 2.3'
]
end

let(:procedure) { create(:procedure, :published, :for_individual, types_de_champ_public: [{ type: :linked_drop_down_list, libelle: 'linked dropdown', options: options, mandatory: mandatory }]) }
let(:secondary_label) { 'level 2' }
let(:procedure) { create(:procedure, :published, :for_individual, types_de_champ_public: [{ type: :linked_drop_down_list, libelle: 'linked dropdown', options: options, mandatory: mandatory, secondary_libelle: secondary_label }]) }

let(:user_dossier) { user.dossiers.first }
context 'not mandatory' do
Expand All @@ -29,13 +29,13 @@
select('Primary 2', from: 'linked dropdown')

# Secondary menu reflects chosen primary value
expect(page).to have_select('linked dropdown : précisez', options: ['', 'Secondary 2.1', 'Secondary 2.2', 'Secondary 2.3'])
expect(page).to have_select(secondary_label, options: ['', 'Secondary 2.1', 'Secondary 2.2', 'Secondary 2.3'])

# Select another primary value
select('Primary 1', from: 'linked dropdown')

# Secondary menu gets updated
expect(page).to have_select("linked dropdown : précisez", options: ['', 'Secondary 1.1', 'Secondary 1.2'])
expect(page).to have_select(secondary_label, options: ['', 'Secondary 1.1', 'Secondary 1.2'])
end
end

Expand All @@ -49,16 +49,16 @@
expect(page).to have_select("linked dropdown", options: ['', 'Primary 1', 'Primary 2'])

# Select a primary value
select('Primary 2', from: 'linked dropdown *')
select('Primary 2', from: 'linked dropdown')

# Secondary menu reflects chosen primary value
expect(page).to have_select('linked dropdown : précisez', options: ['', 'Secondary 2.1', 'Secondary 2.2', 'Secondary 2.3'])
expect(page).to have_select(secondary_label, options: ['', 'Secondary 2.1', 'Secondary 2.2', 'Secondary 2.3'])

# Select another primary value
select('Primary 1', from: 'linked dropdown *')
select('Primary 1', from: 'linked dropdown')

# Secondary menu gets updated
expect(page).to have_select("linked dropdown : précisez", options: ['', 'Secondary 1.1', 'Secondary 1.2'])
expect(page).to have_select(secondary_label, options: ['', 'Secondary 1.1', 'Secondary 1.2'])
end
end

Expand Down

0 comments on commit 10f7cba

Please sign in to comment.