feat(type_de_champ_editor): show tdc position indexed starting at 1 not 0
This commit is contained in:
parent
aa6f5a57cd
commit
b8a155a7ee
3 changed files with 7 additions and 7 deletions
|
@ -261,7 +261,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
page.find(initial_first_coordinate_selector).click
|
||||
expect(page).to have_selector("#{initial_first_coordinate_selector} option", count: 3)
|
||||
expect(page.find(initial_first_coordinate_selector).find("option[selected]").value.to_s).to eq(initial_first_coordinate.stable_id.to_s)
|
||||
expect(page.find(initial_first_coordinate_selector).all("option").map(&:text)).to match_array(['0 first_tdc', '1 middle_tdc', '2 last_tdc'])
|
||||
expect(page.find(initial_first_coordinate_selector).all("option").map(&:text)).to match_array(['1 first_tdc', '2 middle_tdc', '3 last_tdc'])
|
||||
|
||||
# renaming a tdc renames it's option
|
||||
within "##{dom_id(initial_first_coordinate, :type_de_champ_editor)}" do
|
||||
|
@ -272,7 +272,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
expect(page).to have_text('Formulaire enregistré')
|
||||
page.find(initial_first_coordinate_selector).click
|
||||
expect(page).to have_css("#{initial_first_coordinate_selector} option", count: 3)
|
||||
expect(page.find(initial_first_coordinate_selector).all("option").map(&:text)).to match_array(['0 renamed', '1 middle_tdc', '2 last_tdc'])
|
||||
expect(page.find(initial_first_coordinate_selector).all("option").map(&:text)).to match_array(['1 renamed', '2 middle_tdc', '3 last_tdc'])
|
||||
end
|
||||
|
||||
scenario 'when select is changed, it move the coordinates' do
|
||||
|
@ -290,7 +290,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
# check reorder rerendered champ component between target->destination
|
||||
reordered_coordinates.map(&:reload).map do |coordinate|
|
||||
expect(page).to have_selector("##{ActionView::RecordIdentifier.dom_id(coordinate, :type_de_champ_editor)} .position", text: coordinate.position)
|
||||
expect(page).to have_selector("##{ActionView::RecordIdentifier.dom_id(coordinate, :type_de_champ_editor)} .position", text: coordinate.position + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -323,7 +323,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
expect(page).to have_selector("#{first_child_coordinate_selector} option", count: 2)
|
||||
|
||||
opts = page.find(first_child_coordinate_selector).all("option").map(&:text)
|
||||
expect(opts).to match_array(children_coordinates.map { "#{_1.position} #{_1.libelle}" })
|
||||
expect(opts).to match_array(children_coordinates.map { "#{_1.position + 1} #{_1.libelle}" })
|
||||
end
|
||||
|
||||
scenario 'when first child select is changed, move champ in repetition' do
|
||||
|
@ -343,7 +343,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
# check reorder rerendered champ component between target->destination
|
||||
reordered_coordinates.map(&:reload).map do |coordinate|
|
||||
expect(page).to have_selector("##{ActionView::RecordIdentifier.dom_id(coordinate, :type_de_champ_editor)} .position", text: coordinate.position)
|
||||
expect(page).to have_selector("##{ActionView::RecordIdentifier.dom_id(coordinate, :type_de_champ_editor)} .position", text: coordinate.position + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue