remove flash success messages
This commit is contained in:
parent
2c6a9e7bf2
commit
9c641ccee1
4 changed files with 15 additions and 17 deletions
|
@ -10,8 +10,6 @@ module Administrateurs
|
|||
@coordinate = draft.coordinate_for(type_de_champ)
|
||||
@created = champ_component_from(@coordinate, focused: true)
|
||||
@morphed = champ_components_starting_at(@coordinate, 1)
|
||||
|
||||
flash.notice = "Formulaire enregistré"
|
||||
else
|
||||
flash.alert = type_de_champ.errors.full_messages
|
||||
end
|
||||
|
@ -28,8 +26,6 @@ module Administrateurs
|
|||
elsif type_de_champ.update(type_de_champ_update_params)
|
||||
@coordinate = draft.coordinate_for(type_de_champ)
|
||||
@morphed = champ_components_starting_at(@coordinate)
|
||||
|
||||
flash.notice = "Formulaire enregistré"
|
||||
else
|
||||
flash.alert = type_de_champ.errors.full_messages
|
||||
end
|
||||
|
@ -49,12 +45,10 @@ module Administrateurs
|
|||
end
|
||||
|
||||
def move
|
||||
flash.notice = "Formulaire enregistré"
|
||||
draft.move_type_de_champ(params[:stable_id], params[:position].to_i)
|
||||
end
|
||||
|
||||
def move_up
|
||||
flash.notice = "Formulaire enregistré"
|
||||
@coordinate = draft.move_up_type_de_champ(params[:stable_id])
|
||||
@destroyed = @coordinate
|
||||
@created = champ_component_from(@coordinate)
|
||||
|
@ -63,7 +57,6 @@ module Administrateurs
|
|||
end
|
||||
|
||||
def move_down
|
||||
flash.notice = "Formulaire enregistré"
|
||||
@coordinate = draft.move_down_type_de_champ(params[:stable_id])
|
||||
@destroyed = @coordinate
|
||||
@created = champ_component_from(@coordinate)
|
||||
|
@ -80,7 +73,6 @@ module Administrateurs
|
|||
flash.alert = errors
|
||||
else
|
||||
@coordinate = draft.remove_type_de_champ(params[:stable_id])
|
||||
flash.notice = "Formulaire enregistré"
|
||||
|
||||
if @coordinate.present?
|
||||
@destroyed = @coordinate
|
||||
|
|
|
@ -81,6 +81,11 @@ module SystemHelpers
|
|||
execute_script("document.querySelector('#autosave-notice').remove();")
|
||||
end
|
||||
|
||||
def hide_autonotice_message
|
||||
expect(page).to have_text('Formulaire enregistré')
|
||||
execute_script("document.querySelector('#autosave-notice').classList.add('hidden');")
|
||||
end
|
||||
|
||||
def blur
|
||||
page.find('body').click
|
||||
end
|
||||
|
|
|
@ -34,7 +34,8 @@ describe 'Creating a new procedure', js: true do
|
|||
visit champs_admin_procedure_path(procedure)
|
||||
|
||||
add_champ
|
||||
remove_flash_message
|
||||
hide_autonotice_message
|
||||
|
||||
fill_in 'Libellé du champ', with: 'libelle de champ'
|
||||
blur
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
|
@ -51,7 +52,7 @@ describe 'Creating a new procedure', js: true do
|
|||
|
||||
# Add an empty repetition type de champ
|
||||
add_champ
|
||||
remove_flash_message
|
||||
hide_autonotice_message
|
||||
select('Bloc répétable', from: 'Type de champ')
|
||||
fill_in 'Libellé du champ', with: 'libellé de champ'
|
||||
blur
|
||||
|
|
|
@ -71,7 +71,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
scenario "removing champs" do
|
||||
add_champ
|
||||
remove_flash_message
|
||||
hide_autonotice_message
|
||||
|
||||
fill_in 'Libellé du champ', with: 'libellé de champ'
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
|
@ -90,19 +90,19 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
scenario "adding an invalid champ" do
|
||||
add_champ
|
||||
remove_flash_message
|
||||
hide_autonotice_message
|
||||
|
||||
fill_in 'Libellé du champ', with: ''
|
||||
fill_in 'Description du champ (optionnel)', with: 'description du champ'
|
||||
expect(page).not_to have_content('Formulaire enregistré')
|
||||
expect(page).to have_no_text(:visible, 'Formulaire enregistré')
|
||||
|
||||
fill_in 'Libellé du champ', with: 'libellé de champ'
|
||||
expect(page).to have_content('Formulaire enregistré')
|
||||
expect(page).to have_text('Formulaire enregistré')
|
||||
end
|
||||
|
||||
scenario "adding a repetition champ" do
|
||||
add_champ
|
||||
remove_flash_message
|
||||
hide_autonotice_message
|
||||
|
||||
select('Bloc répétable', from: 'Type de champ')
|
||||
fill_in 'Libellé du champ', with: 'libellé de champ'
|
||||
|
@ -131,7 +131,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
scenario "adding a carte champ" do
|
||||
add_champ
|
||||
remove_flash_message
|
||||
hide_autonotice_message
|
||||
|
||||
select('Carte', from: 'Type de champ')
|
||||
fill_in 'Libellé du champ', with: 'Libellé de champ carte', fill_options: { clear: :backspace }
|
||||
|
@ -153,7 +153,7 @@ describe 'As an administrateur I can edit types de champ', js: true do
|
|||
|
||||
scenario "adding a dropdown champ" do
|
||||
add_champ
|
||||
remove_flash_message
|
||||
hide_autonotice_message
|
||||
|
||||
select('Choix simple', from: 'Type de champ')
|
||||
fill_in 'Libellé du champ', with: 'Libellé de champ menu déroulant', fill_options: { clear: :backspace }
|
||||
|
|
Loading…
Add table
Reference in a new issue