Merge pull request #7690 from mfo/US/novalidate-editor
feat(brouillon.edit.form): novalidate
This commit is contained in:
commit
ac246c6775
2 changed files with 30 additions and 3 deletions
|
@ -6,7 +6,7 @@
|
|||
- else
|
||||
- form_options = { url: modifier_dossier_url(dossier), method: :patch }
|
||||
|
||||
= form_for dossier, form_options.merge({ html: { id: 'dossier-edit-form', class: 'form', multipart: true } }) do |f|
|
||||
= form_for dossier, form_options.merge({ html: { id: 'dossier-edit-form', class: 'form', multipart: true, novalidate: 'novalidate' } }) do |f|
|
||||
|
||||
.prologue
|
||||
%p.mandatory-explanation= t('utils.asterisk_html')
|
||||
|
|
|
@ -269,6 +269,35 @@ describe 'The user' do
|
|||
context 'with condition' do
|
||||
include Logic
|
||||
|
||||
context 'with a repetition' do
|
||||
let(:procedure) do
|
||||
procedure = create(:procedure, :published, :for_individual,
|
||||
types_de_champ_public: [
|
||||
{ type: :integer_number, libelle: 'age' },
|
||||
{
|
||||
type: :repetition, libelle: 'repetition', children: [
|
||||
{ type: :text, libelle: 'nom', mandatory: true }
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
age = procedure.published_revision.types_de_champ.where(libelle: 'age').first
|
||||
repetition = procedure.published_revision.types_de_champ.repetition.first
|
||||
repetition.update(condition: greater_than_eq(champ_value(age.stable_id), constant(18)))
|
||||
|
||||
procedure
|
||||
end
|
||||
|
||||
scenario 'submit a dossier with an hidden mandatory champ within a repetition', js: true do
|
||||
log_in(user, procedure)
|
||||
|
||||
fill_individual
|
||||
fill_in('age', with: 10)
|
||||
click_on 'Déposer le dossier'
|
||||
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a required conditionnal champ' do
|
||||
let(:procedure) do
|
||||
procedure = create(:procedure, :published, :for_individual,
|
||||
|
@ -278,7 +307,6 @@ describe 'The user' do
|
|||
])
|
||||
|
||||
age, nom = procedure.draft_revision.types_de_champ.all
|
||||
|
||||
nom.update(condition: greater_than_eq(champ_value(age.stable_id), constant(18)))
|
||||
|
||||
procedure
|
||||
|
@ -288,7 +316,6 @@ describe 'The user' do
|
|||
log_in(user, procedure)
|
||||
|
||||
fill_individual
|
||||
|
||||
click_on 'Déposer le dossier'
|
||||
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue