[Types de Champ Editeur] Save on change and only edited model
This commit is contained in:
parent
dea78e2e4e
commit
5da5f75c5f
14 changed files with 351 additions and 254 deletions
|
@ -102,7 +102,8 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_0_libelle')
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libelle de champ'
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
blur
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
|
||||
within '.footer' do
|
||||
click_on 'Ajouter un champ'
|
||||
|
@ -129,7 +130,8 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
page.refresh
|
||||
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libelle de champ'
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
blur
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
|
||||
click_on Procedure.last.libelle
|
||||
click_on 'onglet-pieces'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As an administrateur I edit procedure', js: true do
|
||||
feature 'As an administrateur I can edit types de champ', js: true do
|
||||
let(:administrateur) { procedure.administrateur }
|
||||
let(:procedure) { create(:procedure) }
|
||||
|
||||
|
@ -18,14 +18,15 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
end
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_0_libelle')
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libellé de champ'
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
blur
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
|
||||
page.refresh
|
||||
within '.footer' do
|
||||
click_on 'Enregistrer'
|
||||
end
|
||||
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
end
|
||||
|
||||
it "Add multiple champs" do
|
||||
|
@ -34,33 +35,29 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
click_on 'Ajouter un champ'
|
||||
click_on 'Ajouter un champ'
|
||||
end
|
||||
expect(page).not_to have_content('Le libellé doit être rempli.')
|
||||
expect(page).not_to have_content('Modifications non sauvegardées.')
|
||||
expect(page).not_to have_content('Formulaire mis à jour')
|
||||
expect(page).not_to have_content('Formulaire enregistré')
|
||||
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libellé de champ 0'
|
||||
fill_in 'procedure_types_de_champ_attributes_1_libelle', with: 'libellé de champ 1'
|
||||
blur
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_0_libelle')
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_1_libelle')
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_2_libelle')
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_3_libelle')
|
||||
|
||||
expect(page).to have_content('Le libellé doit être rempli.')
|
||||
expect(page).to have_content('Modifications non sauvegardées.')
|
||||
expect(page).not_to have_content('Formulaire mis à jour')
|
||||
fill_in 'procedure_types_de_champ_attributes_2_libelle', with: 'libellé de champ 2'
|
||||
|
||||
within '.draggable-item-3' do
|
||||
within '.draggable-item-2' do
|
||||
click_on 'Supprimer'
|
||||
end
|
||||
|
||||
expect(page).to have_content('Le libellé doit être rempli.')
|
||||
expect(page).to have_content('Modifications non sauvegardées.')
|
||||
expect(page).not_to have_content('Formulaire mis à jour')
|
||||
fill_in 'procedure_types_de_champ_attributes_1_libelle', with: 'libellé de champ 1'
|
||||
expect(page).not_to have_selector('#procedure_types_de_champ_attributes_3_libelle')
|
||||
fill_in 'procedure_types_de_champ_attributes_2_libelle', with: 'libellé de champ 2'
|
||||
blur
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
|
||||
expect(page).to have_content('Supprimer', count: 3)
|
||||
|
||||
expect(page).not_to have_content('Le libellé doit être rempli.')
|
||||
expect(page).not_to have_content('Modifications non sauvegardées.')
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
page.refresh
|
||||
|
||||
expect(page).to have_content('Supprimer', count: 3)
|
||||
|
@ -68,11 +65,12 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
|
||||
it "Remove champs" do
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libellé de champ'
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
blur
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
page.refresh
|
||||
|
||||
click_on 'Supprimer'
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
expect(page).not_to have_content('Supprimer')
|
||||
page.refresh
|
||||
|
||||
|
@ -82,19 +80,21 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
it "Only add valid champs" do
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_0_description')
|
||||
fill_in 'procedure_types_de_champ_attributes_0_description', with: 'déscription du champ'
|
||||
expect(page).to have_content('Le libellé doit être rempli.')
|
||||
expect(page).not_to have_content('Formulaire mis à jour')
|
||||
blur
|
||||
expect(page).not_to have_content('Formulaire enregistré')
|
||||
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libellé de champ'
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
blur
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
end
|
||||
|
||||
it "Add repetition champ" do
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_0_libelle')
|
||||
select('Bloc répétable', from: 'procedure_types_de_champ_attributes_0_type_champ')
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libellé de champ'
|
||||
blur
|
||||
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
page.refresh
|
||||
|
||||
within '.flex-grow' do
|
||||
|
@ -102,8 +102,9 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
end
|
||||
|
||||
fill_in 'procedure_types_de_champ_attributes_0_types_de_champ_attributes_0_libelle', with: 'libellé de champ 1'
|
||||
blur
|
||||
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
expect(page).to have_content('Supprimer', count: 2)
|
||||
|
||||
within '.footer' do
|
||||
|
@ -112,6 +113,7 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
|
||||
select('Bloc répétable', from: 'procedure_types_de_champ_attributes_1_type_champ')
|
||||
fill_in 'procedure_types_de_champ_attributes_1_libelle', with: 'libellé de champ 2'
|
||||
blur
|
||||
|
||||
expect(page).to have_content('Supprimer', count: 3)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue