Merge pull request #10547 from colinux/mandatory-by-default

ETQ admin, un nouveau champ est obligatoire par défaut
This commit is contained in:
Colin Darie 2024-07-02 14:26:29 +00:00 committed by GitHub
commit b3ccfc16c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 100 additions and 61 deletions

View file

@ -177,11 +177,11 @@ describe 'As an administrateur I can edit types de champ', js: true do
# It displays the estimate when adding a new champ
add_champ
select('Pièce justificative', from: 'Type de champ')
expect(page).to have_content('Durée de remplissage estimée : 2 min')
expect(page).to have_content('Durée de remplissage estimée : 3 min')
# It updates the estimate when updating the champ
check 'Champ obligatoire'
expect(page).to have_content('Durée de remplissage estimée : 3 min')
uncheck 'Champ obligatoire'
expect(page).to have_content('Durée de remplissage estimée : 2 min')
# It updates the estimate when removing the champ
page.accept_alert do

View file

@ -252,10 +252,10 @@ describe 'fetch API Particulier Data', js: true do
instructeurs: [instructeur],
api_particulier_sources: expected_sources,
api_particulier_token: api_particulier_token).tap do |p|
p.active_revision.add_type_de_champ(type_champ: :cnaf, libelle: 'cnaf')
p.active_revision.add_type_de_champ(type_champ: :dgfip, libelle: 'dgfip')
p.active_revision.add_type_de_champ(type_champ: :pole_emploi, libelle: 'pole_emploi')
p.active_revision.add_type_de_champ(type_champ: :mesri, libelle: 'mesri')
p.active_revision.add_type_de_champ(type_champ: :cnaf, libelle: 'cnaf', mandatory: false)
p.active_revision.add_type_de_champ(type_champ: :dgfip, libelle: 'dgfip', mandatory: false)
p.active_revision.add_type_de_champ(type_champ: :pole_emploi, libelle: 'pole_emploi', mandatory: false)
p.active_revision.add_type_de_champ(type_champ: :mesri, libelle: 'mesri', mandatory: false)
end
end

View file

@ -3,8 +3,8 @@ describe 'The routing with rules', js: true do
let(:procedure) do
create(:procedure, :with_service, :for_individual, :with_zone, types_de_champ_public: [
{ type: :text, libelle: 'un premier champ text' },
{ type: :drop_down_list, libelle: 'Spécialité', options: ["", "littéraire", "scientifique", "artistique"] }
{ type: :text, libelle: 'un premier champ text', mandatory: false },
{ type: :drop_down_list, libelle: 'Spécialité', options: ["", "littéraire", "scientifique", "artistique"], mandatory: false }
])
end
let(:administrateur) { create(:administrateur, procedures: [procedure]) }

View file

@ -410,7 +410,7 @@ describe 'The user' do
let(:procedure) do
create(:procedure, :published, :for_individual,
types_de_champ_public: [
{ type: :integer_number, libelle: 'age', stable_id: },
{ type: :integer_number, libelle: 'age', mandatory: false, stable_id: },
{
type: :repetition, libelle: 'repetition', condition:, children: [
{ type: :text, libelle: 'nom', mandatory: true }
@ -439,7 +439,7 @@ describe 'The user' do
let(:procedure) do
create(:procedure, :published, :for_individual,
types_de_champ_public: [
{ type: :checkbox, libelle: 'champ_a', stable_id: a_stable_id },
{ type: :checkbox, libelle: 'champ_a', mandatory: false, stable_id: a_stable_id },
{
type: :repetition, libelle: 'repetition', mandatory: true, children: [
{ type: :checkbox, libelle: 'champ_b', stable_id: b_stable_id },
@ -476,7 +476,7 @@ describe 'The user' do
let(:procedure) do
create(:procedure, :published, :for_individual,
types_de_champ_public: [
{ type: :integer_number, libelle: 'age', stable_id: },
{ type: :integer_number, libelle: 'age', mandatory: false, stable_id: },
{ type: :text, libelle: 'nom', mandatory: true, condition: }
])
end
@ -514,11 +514,11 @@ describe 'The user' do
let(:procedure) do
create(:procedure, :published, :for_individual,
types_de_champ_public: [
{ type: :integer_number, libelle: 'age du candidat', 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 }
{ type: :integer_number, libelle: 'age du candidat', stable_id: age_stable_id, mandatory: false },
{ type: :yes_no, libelle: 'permis de conduire', stable_id: permis_stable_id, condition: permis_condition, mandatory: false },
{ type: :header_section, libelle: 'info voiture', condition: permis_condition, mandatory: false },
{ type: :integer_number, libelle: 'tonnage', stable_id: tonnage_stable_id, condition: tonnage_condition, mandatory: false },
{ type: :text, libelle: 'parking', condition: parking_condition, mandatory: false }
])
end

View file

@ -64,7 +64,7 @@ describe 'Dossier Inéligibilité', js: true do
end
describe 'ineligibilite_rules with a Or' do
let(:types_de_champ_public) { [{ type: :yes_no, libelle: 'l1' }, { type: :drop_down_list, libelle: 'l2', options: ['Paris', 'Marseille'] }] }
let(:types_de_champ_public) { [{ type: :yes_no, libelle: 'l1' }, { type: :drop_down_list, libelle: 'l2', options: ['Paris', 'Marseille'], mandatory: false }] }
let(:ineligibilite_rules) do
ds_or([
ds_eq(champ_value(first_tdc.stable_id), constant(true)),
@ -134,7 +134,7 @@ describe 'Dossier Inéligibilité', js: true do
end
describe 'ineligibilite_rules with a And and all visible champs' do
let(:types_de_champ_public) { [{ type: :yes_no, libelle: 'l1' }, { type: :drop_down_list, libelle: 'l2', options: ['Paris', 'Marseille'] }] }
let(:types_de_champ_public) { [{ type: :yes_no, libelle: 'l1' }, { type: :drop_down_list, libelle: 'l2', options: ['Paris', 'Marseille'], mandatory: false }] }
let(:ineligibilite_rules) do
ds_and([
ds_eq(champ_value(first_tdc.stable_id), constant(true)),