Add a default text type de champ to editor
This commit is contained in:
parent
2754dc9c9e
commit
1d75a32cac
4 changed files with 12 additions and 20 deletions
|
@ -130,9 +130,7 @@ export default {
|
|||
addChamp() {
|
||||
this.typesDeChamp.push({
|
||||
type_champ: 'text',
|
||||
drop_down_list: {},
|
||||
types_de_champ: [],
|
||||
options: {}
|
||||
types_de_champ: []
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,14 @@ function initEditor(el) {
|
|||
|
||||
this.update = update;
|
||||
this.updateAll = updateAll;
|
||||
|
||||
// We add an initial type de champ here if form is empty
|
||||
if (this.state.typesDeChamp.length === 0) {
|
||||
this.state.typesDeChamp.push({
|
||||
type_champ: 'text',
|
||||
types_de_champ: []
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -100,9 +100,6 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
page.refresh
|
||||
expect(page).to have_current_path(champs_procedure_path(Procedure.last))
|
||||
|
||||
within '.footer' do
|
||||
click_on 'Ajouter un champ'
|
||||
end
|
||||
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')
|
||||
|
@ -131,9 +128,6 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
scenario 'After adding champ and file, make publication' do
|
||||
page.refresh
|
||||
|
||||
within '.footer' do
|
||||
click_on 'Ajouter un champ'
|
||||
end
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libelle de champ'
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
end
|
||||
|
||||
it "Add a new champ" do
|
||||
click_on 'Supprimer'
|
||||
|
||||
within '.footer' do
|
||||
click_on 'Ajouter un champ'
|
||||
end
|
||||
|
@ -31,7 +33,6 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
click_on 'Ajouter un champ'
|
||||
click_on 'Ajouter un champ'
|
||||
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.')
|
||||
|
@ -66,9 +67,6 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
end
|
||||
|
||||
it "Remove champs" do
|
||||
within '.footer' do
|
||||
click_on 'Ajouter un champ'
|
||||
end
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libellé de champ'
|
||||
expect(page).to have_content('Formulaire mis à jour')
|
||||
page.refresh
|
||||
|
@ -78,13 +76,10 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
expect(page).not_to have_content('Supprimer')
|
||||
page.refresh
|
||||
|
||||
expect(page).not_to have_content('Supprimer')
|
||||
expect(page).to have_content('Supprimer', count: 1)
|
||||
end
|
||||
|
||||
it "Only add valid champs" do
|
||||
within '.footer' do
|
||||
click_on 'Ajouter un champ'
|
||||
end
|
||||
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.')
|
||||
|
@ -95,9 +90,6 @@ feature 'As an administrateur I edit procedure', js: true do
|
|||
end
|
||||
|
||||
it "Add repetition champ" do
|
||||
within '.footer' do
|
||||
click_on 'Ajouter un champ'
|
||||
end
|
||||
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'
|
||||
|
|
Loading…
Reference in a new issue