Browse Source

Success banner design (#111)

* flash message styles added

* sucessful flash test added
pull/112/head
Matthew J. Phelan 3 years ago committed by GitHub
parent
commit
03caaea590
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      app/views/layouts/application.html.erb
  2. 7
      spec/features/user_spec.rb

14
app/views/layouts/application.html.erb

@ -17,9 +17,6 @@
<%= javascript_pack_tag 'application', defer: true %> <%= javascript_pack_tag 'application', defer: true %>
<%= capybara_lockstep if defined?(Capybara::Lockstep) %> <%= capybara_lockstep if defined?(Capybara::Lockstep) %>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<% if Rails.env.development? %> <% if Rails.env.development? %>
<script> <script>
console.log(<%= session.to_json.html_safe %>) console.log(<%= session.to_json.html_safe %>)
@ -29,6 +26,7 @@
<body class="govuk-template__body "> <body class="govuk-template__body ">
<script> <script>
document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled'); document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
</script> </script>
@ -43,7 +41,6 @@
) )
%> %>
</header> </header>
<aside class="govuk-width-container"> <aside class="govuk-width-container">
<%= render GovukComponent::PhaseBannerComponent.new( <%= render GovukComponent::PhaseBannerComponent.new(
tag: { text: 'Beta' }, tag: { text: 'Beta' },
@ -57,6 +54,15 @@
</div> </div>
<main class="govuk-main-wrapper " id="main-content" role="main"> <main class="govuk-main-wrapper " id="main-content" role="main">
<% flash.each do |type, msg| %>
<%= render GovukComponent::NotificationBannerComponent.new(
title_text: 'Success',
success: true, title_heading_level: 3,
title_id: "swanky-notifications") do |notification_banner|
notification_banner.heading(text: msg)
end
%>
<% end %>
<%= yield %> <%= yield %>
</main> </main>
</div> </div>

7
spec/features/user_spec.rb

@ -49,5 +49,12 @@ RSpec.describe "User Features" do
fill_in("user_email", with: user.email) fill_in("user_email", with: user.email)
expect { click_button("Send email") }.to change { ActionMailer::Base.deliveries.count }.by(1) expect { click_button("Send email") }.to change { ActionMailer::Base.deliveries.count }.by(1)
end end
it " is shown the password reset confirmation page and successful flash message shows" do
visit("/users/password/new")
fill_in("user_email", with: user.email)
click_button("Send email")
expect(page).to have_css '.govuk-notification-banner.govuk-notification-banner--success'
end
end end
end end

Loading…
Cancel
Save