tech(refactor): procedure::error_summary and dossier::ErrorsFullMessagesComponent use same behaviour to compact/expand errors
This commit is contained in:
parent
c480bc00c3
commit
e3a24d53ea
16 changed files with 115 additions and 78 deletions
|
@ -11,27 +11,33 @@ describe Procedure::ErrorsSummary, type: :component do
|
|||
context 'when :publication' do
|
||||
let(:validation_context) { :publication }
|
||||
|
||||
it 'shows errors for public and private tdc' do
|
||||
expect(page).to have_text("Le champ « public » doit comporter au moins un choix sélectionnable")
|
||||
expect(page).to have_text("L’annotation privée « private » doit comporter au moins un choix sélectionnable")
|
||||
it 'shows errors and links for public and private tdc' do
|
||||
expect(page).to have_content("Erreur : Des problèmes empêchent la publication de la démarche")
|
||||
expect(page).to have_selector("a", text: "public")
|
||||
expect(page).to have_selector("a", text: "private")
|
||||
expect(page).to have_text("doit comporter au moins un choix sélectionnable", count: 2)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when :types_de_champ_public_editor' do
|
||||
let(:validation_context) { :types_de_champ_public_editor }
|
||||
|
||||
it 'shows errors for public only tdc' do
|
||||
expect(page).to have_text("Le champ « public » doit comporter au moins un choix sélectionnable")
|
||||
expect(page).not_to have_text("L’annotation privée « private » doit comporter au moins un choix sélectionnable")
|
||||
it 'shows errors and links for public only tdc' do
|
||||
expect(page).to have_text("Erreur : Les champs formulaire contiennent des erreurs")
|
||||
expect(page).to have_selector("a", text: "public")
|
||||
expect(page).to have_text("doit comporter au moins un choix sélectionnable", count: 1)
|
||||
expect(page).not_to have_selector("a", text: "private")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when :types_de_champ_private_editor' do
|
||||
let(:validation_context) { :types_de_champ_private_editor }
|
||||
|
||||
it 'shows errors for private only tdc' do
|
||||
expect(page).not_to have_text("Le champ « public » doit comporter au moins un choix sélectionnable")
|
||||
expect(page).to have_text("L’annotation privée « private » doit comporter au moins un choix sélectionnable")
|
||||
it 'shows errors and links for private only tdc' do
|
||||
expect(page).to have_text("Erreur : Les annotations privées contiennent des erreurs")
|
||||
expect(page).to have_selector("a", text: "private")
|
||||
expect(page).to have_text("doit comporter au moins un choix sélectionnable")
|
||||
expect(page).not_to have_selector("a", text: "public")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -52,12 +58,18 @@ describe Procedure::ErrorsSummary, type: :component do
|
|||
|
||||
before { subject }
|
||||
|
||||
it 'renders all errors on champ' do
|
||||
expect(page).to have_text("Le champ « drop down list requires options » doit comporter au moins un choix sélectionnable")
|
||||
expect(page).to have_text("Le champ « repetition requires children » doit comporter au moins un champ répétable")
|
||||
expect(page).to have_text("Le champ « invalid condition » a une logique conditionnelle invalide")
|
||||
expect(page).to have_text("Le champ « header sections must have consistent order » devrait être précédé d'un titre de niveau 1")
|
||||
# TODO, test attestation_template, initiated_mail, :received_mail, :closed_mail, :refused_mail, :without_continuation_mail, :re_instructed_mail
|
||||
it 'renders all errors and links on champ' do
|
||||
expect(page).to have_selector("a", text: "drop down list requires options")
|
||||
expect(page).to have_content("doit comporter au moins un choix sélectionnable")
|
||||
|
||||
expect(page).to have_selector("a", text: "repetition requires children")
|
||||
expect(page).to have_content("doit comporter au moins un champ répétable")
|
||||
|
||||
expect(page).to have_selector("a", text: "invalid condition")
|
||||
expect(page).to have_content("a une logique conditionnelle invalide")
|
||||
|
||||
expect(page).to have_selector("a", text: "header sections must have consistent order")
|
||||
expect(page).to have_content("devrait être précédé d'un titre de niveau 1")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -73,8 +85,9 @@ describe Procedure::ErrorsSummary, type: :component do
|
|||
end
|
||||
|
||||
it 'render error nicely' do
|
||||
expect(page).to have_text("Le modèle d’attestation n'est pas valide")
|
||||
expect(page).to have_text("L’email de notification de passage de dossier en instruction n'est pas valide")
|
||||
expect(page).to have_selector("a", text: "Le modèle d’attestation")
|
||||
expect(page).to have_selector("a", text: "L’email de notification de passage de dossier en instruction")
|
||||
expect(page).to have_text("n'est pas valide", count: 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue