feat(admin): disable publish button when there are errors
This commit is contained in:
parent
d0837c58f5
commit
eccfde848f
2 changed files with 5 additions and 1 deletions
|
@ -6,4 +6,5 @@
|
|||
= t('.intro_html').html_safe
|
||||
%span.no-wrap
|
||||
= link_to t('.see_changes'), admin_procedure_path(procedure), class: 'fr-btn fr-btn--secondary fr-mr-2w'
|
||||
= link_to t('.publish_changes'), admin_procedure_publish_revision_path(procedure), class: 'fr-btn', method: :put, data: { disable_with: "Publication...", confirm: 'Êtes-vous sûr de vouloir publier les modifications ?' }
|
||||
= link_to_if procedure.draft_revision.valid? && procedure.valid?(:publication), t('.publish_changes'), admin_procedure_publish_revision_path(procedure), class: 'fr-btn', method: :put, data: { disable_with: "Publication...", confirm: 'Êtes-vous sûr de vouloir publier les modifications ?' } do
|
||||
%button.fr-btn{ disabled: "disabled" }= t('.publish_changes')
|
||||
|
|
|
@ -379,6 +379,8 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
within all('.type-de-champ').last do
|
||||
fill_in 'Libellé du champ', with: 'Deuxième champ'
|
||||
select 'Choix simple', from: 'Type de champ'
|
||||
fill_in "Options de la liste", with: "" # make tdc invalid
|
||||
end
|
||||
|
||||
expect(page).to have_field('Libellé du champ', with: 'Premier champ')
|
||||
|
@ -386,6 +388,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
expect(page).to have_selector('.sticky-header.sticky-header-warning')
|
||||
expect(page).to have_content("Les modifications effectuées ne seront visibles qu'à la prochaine publication")
|
||||
expect(page).to have_button('Publier les modifications', disabled: true)
|
||||
|
||||
# Supprime dernier champ
|
||||
all('.fr-btn--tertiary-no-outline[title="Supprimer le champ"]').last.click
|
||||
|
|
Loading…
Reference in a new issue