Merge pull request #6804 from betagouv/fix-invisible-captcha-flash

Correction d'une erreur dans le formulaire de contact
This commit is contained in:
Pierre de La Morinerie 2022-01-06 14:27:04 +01:00 committed by GitHub
commit e4755c5433
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View file

@ -8,12 +8,15 @@ module ApplicationHelper
end
def flash_class(level, sticky: false, fixed: false)
class_names = case level
class_names = []
case level
when 'notice'
['alert-success']
when 'alert'
['alert-danger']
class_names << 'alert-success'
when 'alert', 'error'
class_names << 'alert-danger'
end
if sticky
class_names << 'sticky'
end

View file

@ -18,6 +18,13 @@ describe ApplicationHelper do
end
end
describe "#flash_class" do
it { expect(flash_class('notice')).to eq 'alert-success' }
it { expect(flash_class('alert', sticky: true, fixed: true)).to eq 'alert-danger sticky alert-fixed' }
it { expect(flash_class('error')).to eq 'alert-danger' }
it { expect(flash_class('unknown-level')).to eq '' }
end
describe "#try_format_date" do
subject { try_format_date(date) }