Browse Source

More tweaks

update-version-test
Kat 12 months ago
parent
commit
ea1d31f18a
  1. 4
      app/components/bulk_upload_error_row_component.html.erb
  2. 4
      app/components/bulk_upload_error_summary_table_component.html.erb
  3. 2
      app/helpers/data_sharing_agreement_helper.rb
  4. 4
      app/views/layouts/application.html.erb
  5. 4
      app/views/logs/_delete_logs_table_lettings.html.erb
  6. 4
      app/views/logs/_delete_logs_table_sales.html.erb
  7. 2
      app/views/logs/index.html.erb
  8. 4
      app/views/logs/update_logs.html.erb
  9. 8
      spec/features/form/form_navigation_spec.rb
  10. 4
      spec/features/form/validations_spec.rb
  11. 22
      spec/features/user_spec.rb
  12. 2
      spec/requests/auth/confirmations_controller_spec.rb
  13. 8
      spec/requests/users_controller_spec.rb

4
app/components/bulk_upload_error_row_component.html.erb

@ -9,7 +9,7 @@
<div class="govuk-summary-card__content"> <div class="govuk-summary-card__content">
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<% table.with_head do |head| %> <%= table.with_head do |head| %>
<% head.with_row do |row| %> <% head.with_row do |row| %>
<% row.with_cell(header: true, text: "Cell") %> <% row.with_cell(header: true, text: "Cell") %>
<% row.with_cell(header: true, text: "Question") %> <% row.with_cell(header: true, text: "Question") %>
@ -17,7 +17,7 @@
<% row.with_cell(header: true, text: "Specification") %> <% row.with_cell(header: true, text: "Specification") %>
<% end %> <% end %>
<% table.with_body do |body| %> <%= table.with_body do |body| %>
<% bulk_upload_errors.each do |error| %> <% bulk_upload_errors.each do |error| %>
<% body.with_row do |row| %> <% body.with_row do |row| %>
<% row.with_cell(header: true, text: error.cell) %> <% row.with_cell(header: true, text: error.cell) %>

4
app/components/bulk_upload_error_summary_table_component.html.erb

@ -4,13 +4,13 @@
<% sorted_errors.each do |error| %> <% sorted_errors.each do |error| %>
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<% table.with_head do |head| %> <%= table.with_head do |head| %>
<% head.with_row do |row| %> <% head.with_row do |row| %>
<% row.with_cell(text: question_for_field(error[0][1].to_sym), header: true) %> <% row.with_cell(text: question_for_field(error[0][1].to_sym), header: true) %>
<% row.with_cell(text: "Column #{error[0][0]}", header: true, numeric: true) %> <% row.with_cell(text: "Column #{error[0][0]}", header: true, numeric: true) %>
<% end %> <% end %>
<% table.body do |body| %> <%= table.body do |body| %>
<% body.with_row do |row| %> <% body.with_row do |row| %>
<% row.with_cell(text: error[0][2]) %> <% row.with_cell(text: error[0][2]) %>
<% row.with_cell(text: pluralize(error[1], "error"), numeric: true) %> <% row.with_cell(text: pluralize(error[1], "error"), numeric: true) %>

2
app/helpers/data_sharing_agreement_helper.rb

@ -7,7 +7,7 @@ module DataSharingAgreementHelper
text: "View agreement", text: "View agreement",
) )
row.value do row.with_value do
simple_format( simple_format(
data_sharing_agreement_first_line(organisation:, user:), data_sharing_agreement_first_line(organisation:, user:),
wrapper_tag: "span", wrapper_tag: "span",

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

@ -87,7 +87,7 @@
<%= govuk_header( <%= govuk_header(
classes: govuk_header_classes(current_user), classes: govuk_header_classes(current_user),
homepage_url: current_user.nil? ? root_path : logs_path, homepage_url: root_path,
navigation_classes: "govuk-header__navigation--end", navigation_classes: "govuk-header__navigation--end",
) do |component| ) do |component|
component.with_product_name(name: t("service_name")) component.with_product_name(name: t("service_name"))
@ -126,7 +126,7 @@
success: true, title_heading_level: 3, success: true, title_heading_level: 3,
title_id: "swanky-notifications" title_id: "swanky-notifications"
) do |notification_banner| ) do |notification_banner|
notification_banner.heading(text: flash.notice.html_safe) notification_banner.with_heading(text: flash.notice.html_safe)
if flash[:notification_banner_body] if flash[:notification_banner_body]
tag.p flash[:notification_banner_body]&.html_safe tag.p flash[:notification_banner_body]&.html_safe
end end

4
app/views/logs/_delete_logs_table_lettings.html.erb

@ -1,5 +1,5 @@
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<% table.with_head do |head| %> <%= table.with_head do |head| %>
<% head.with_row do |row| %> <% head.with_row do |row| %>
<% row.with_cell header: true, text: "Log ID" %> <% row.with_cell header: true, text: "Log ID" %>
<% row.with_cell header: true, text: "Tenancy code" %> <% row.with_cell header: true, text: "Tenancy code" %>
@ -8,7 +8,7 @@
<% row.with_cell header: true, text: "Delete?" %> <% row.with_cell header: true, text: "Delete?" %>
<% end %> <% end %>
<% end %> <% end %>
<% table.with_body do |body| %> <%= table.with_body do |body| %>
<% f.govuk_check_boxes_fieldset :selected_ids, small: true do %> <% f.govuk_check_boxes_fieldset :selected_ids, small: true do %>
<% delete_logs_form.logs.each do |log| %> <% delete_logs_form.logs.each do |log| %>
<% body.with_row do |row| %> <% body.with_row do |row| %>

4
app/views/logs/_delete_logs_table_sales.html.erb

@ -1,5 +1,5 @@
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<% table.with_head do |head| %> <%= table.with_head do |head| %>
<% head.with_row do |row| %> <% head.with_row do |row| %>
<% row.with_cell header: true, text: "Log ID" %> <% row.with_cell header: true, text: "Log ID" %>
<% row.with_cell header: true, text: "Purchaser code" %> <% row.with_cell header: true, text: "Purchaser code" %>
@ -8,7 +8,7 @@
<% row.with_cell header: true, text: "Delete?" %> <% row.with_cell header: true, text: "Delete?" %>
<% end %> <% end %>
<% end %> <% end %>
<% table.with_body do |body| %> <%= table.with_body do |body| %>
<% f.govuk_check_boxes_fieldset :selected_ids, small: true do %> <% f.govuk_check_boxes_fieldset :selected_ids, small: true do %>
<% delete_logs_form.logs.each do |log| %> <% delete_logs_form.logs.each do |log| %>
<% body.with_row do |row| %> <% body.with_row do |row| %>

2
app/views/logs/index.html.erb

@ -27,7 +27,7 @@
title_heading_level: 3, title_heading_level: 3,
title_id: "impacted-logs-banner", title_id: "impacted-logs-banner",
) do |notification_banner| %> ) do |notification_banner| %>
<% notification_banner.heading(text: "A scheme has changed and it has affected #{@unresolved_count} #{'log'.pluralize(@unresolved_count)}") %> <% notification_banner.with_heading(text: "A scheme has changed and it has affected #{@unresolved_count} #{'log'.pluralize(@unresolved_count)}") %>
<div class="govuk-notification-banner__heading"> <div class="govuk-notification-banner__heading">
<%= govuk_link_to "Update logs", update_logs_lettings_logs_path, class: "govuk-notification-banner__link" %> <%= govuk_link_to "Update logs", update_logs_lettings_logs_path, class: "govuk-notification-banner__link" %>
</div> </div>

4
app/views/logs/update_logs.html.erb

@ -14,7 +14,7 @@
<% else %> <% else %>
<%= render partial: "organisations/headings", locals: { main: "You need to update #{@total_count} logs", sub: "" } %> <%= render partial: "organisations/headings", locals: { main: "You need to update #{@total_count} logs", sub: "" } %>
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<% table.with_head do |head| %> <%= table.with_head do |head| %>
<% head.with_row do |row| %> <% head.with_row do |row| %>
<% row.with_cell(header: true, text: "Log ID") %> <% row.with_cell(header: true, text: "Log ID") %>
<% row.with_cell(header: true, text: "Tenancy code") %> <% row.with_cell(header: true, text: "Tenancy code") %>
@ -24,7 +24,7 @@
<% end %> <% end %>
<% end %> <% end %>
<% @logs.each do |log| %> <% @logs.each do |log| %>
<% table.with_body do |body| %> <%= table.with_body do |body| %>
<% body.with_row do |row| %> <% body.with_row do |row| %>
<% row.with_cell(text: log.id) %> <% row.with_cell(text: log.id) %>
<% row.with_cell(text: log.tenancycode) %> <% row.with_cell(text: log.tenancycode) %>

8
spec/features/form/form_navigation_spec.rb

@ -137,7 +137,7 @@ RSpec.describe "Form Navigation" do
it "shows a validation error on radio questions" do it "shows a validation error on radio questions" do
visit("/lettings-logs/#{id}/renewal") visit("/lettings-logs/#{id}/renewal")
click_button("Save and continue") click_button("Save and continue")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#lettings-log-renewal-error") expect(page).to have_selector("#lettings-log-renewal-error")
expect(page).to have_title("Error") expect(page).to have_title("Error")
end end
@ -145,7 +145,7 @@ RSpec.describe "Form Navigation" do
it "shows a validation error on date questions" do it "shows a validation error on date questions" do
visit("/lettings-logs/#{id}/tenancy-start-date") visit("/lettings-logs/#{id}/tenancy-start-date")
click_button("Save and continue") click_button("Save and continue")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#lettings-log-startdate-error") expect(page).to have_selector("#lettings-log-startdate-error")
expect(page).to have_title("Error") expect(page).to have_title("Error")
end end
@ -156,7 +156,7 @@ RSpec.describe "Form Navigation" do
visit("/lettings-logs/#{id}/armed-forces") visit("/lettings-logs/#{id}/armed-forces")
choose("lettings-log-armedforces-1-field", allow_label_click: true) choose("lettings-log-armedforces-1-field", allow_label_click: true)
click_button("Save and continue") click_button("Save and continue")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#lettings-log-leftreg-error") expect(page).to have_selector("#lettings-log-leftreg-error")
expect(page).to have_title("Error") expect(page).to have_title("Error")
end end
@ -170,7 +170,7 @@ RSpec.describe "Form Navigation" do
it "does not show a validation error" do it "does not show a validation error" do
visit("/lettings-logs/#{id}/tenant-code") visit("/lettings-logs/#{id}/tenant-code")
click_button("Save and continue") click_button("Save and continue")
expect(page).not_to have_selector("#error-summary-title") expect(page).not_to have_selector(".govuk-error-summary__title")
expect(page).not_to have_title("Error") expect(page).not_to have_title("Error")
expect(page).to have_current_path("/lettings-logs/#{id}/property-reference") expect(page).to have_current_path("/lettings-logs/#{id}/property-reference")
end end

4
spec/features/form/validations_spec.rb

@ -55,7 +55,7 @@ RSpec.describe "validations" do
it "shows validation for under 0" do it "shows validation for under 0" do
visit("/lettings-logs/#{id}/person-1-age") visit("/lettings-logs/#{id}/person-1-age")
fill_in_number_question(empty_lettings_log.id, "age1", -5, "person-1-age") fill_in_number_question(empty_lettings_log.id, "age1", -5, "person-1-age")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#lettings-log-age1-error") expect(page).to have_selector("#lettings-log-age1-error")
expect(page).to have_selector("#lettings-log-age1-field-error") expect(page).to have_selector("#lettings-log-age1-field-error")
expect(page).to have_title("Error") expect(page).to have_title("Error")
@ -64,7 +64,7 @@ RSpec.describe "validations" do
it "shows validation for over 120" do it "shows validation for over 120" do
visit("/lettings-logs/#{id}/person-1-age") visit("/lettings-logs/#{id}/person-1-age")
fill_in_number_question(empty_lettings_log.id, "age1", 121, "person-1-age") fill_in_number_question(empty_lettings_log.id, "age1", 121, "person-1-age")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector("#govuk-error-summary__title")
expect(page).to have_selector("#lettings-log-age1-error") expect(page).to have_selector("#lettings-log-age1-error")
expect(page).to have_selector("#lettings-log-age1-field-error") expect(page).to have_selector("#lettings-log-age1-field-error")
expect(page).to have_title("Error") expect(page).to have_title("Error")

22
spec/features/user_spec.rb

@ -65,7 +65,7 @@ RSpec.describe "User Features" do
it "is shown an error message if they submit without entering an email address" do it "is shown an error message if they submit without entering an email address" do
visit("/account/password/new") visit("/account/password/new")
click_button("Send email") click_button("Send email")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_title("Error") expect(page).to have_title("Error")
end end
@ -74,7 +74,7 @@ RSpec.describe "User Features" do
visit("/account/password/new") visit("/account/password/new")
fill_in("user[email]", with: "thisisn'tanemail") fill_in("user[email]", with: "thisisn'tanemail")
click_button("Send email") click_button("Send email")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_title("Error") expect(page).to have_title("Error")
end end
@ -166,7 +166,7 @@ RSpec.describe "User Features" do
fill_in("user[email]", with: user.email) fill_in("user[email]", with: user.email)
fill_in("user[password]", with: "nonsense") fill_in("user[password]", with: "nonsense")
click_button("Sign in") click_button("Sign in")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_no_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_no_css(".govuk-notification-banner.govuk-notification-banner--success")
expect(page).to have_title("Error") expect(page).to have_title("Error")
end end
@ -174,7 +174,7 @@ RSpec.describe "User Features" do
it "show specific field error messages if a field was omitted" do it "show specific field error messages if a field was omitted" do
visit("/lettings-logs") visit("/lettings-logs")
click_button("Sign in") click_button("Sign in")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_selector("#user-password-field-error") expect(page).to have_selector("#user-password-field-error")
expect(page).to have_title("Error") expect(page).to have_title("Error")
@ -184,7 +184,7 @@ RSpec.describe "User Features" do
visit("/lettings-logs") visit("/lettings-logs")
fill_in("user[email]", with: "thisisn'tanemail") fill_in("user[email]", with: "thisisn'tanemail")
click_button("Sign in") click_button("Sign in")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_content(/Enter an email address in the correct format, like name@example.com/) expect(page).to have_content(/Enter an email address in the correct format, like name@example.com/)
expect(page).to have_title("Error") expect(page).to have_title("Error")
@ -201,7 +201,7 @@ RSpec.describe "User Features" do
fill_in("user[email]", with: user.email) fill_in("user[email]", with: user.email)
fill_in("user[password]", with: "pAssword1") fill_in("user[password]", with: "pAssword1")
click_button("Sign in") click_button("Sign in")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_no_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_no_css(".govuk-notification-banner.govuk-notification-banner--success")
expect(page).to have_title("Error") expect(page).to have_title("Error")
end end
@ -379,7 +379,7 @@ RSpec.describe "User Features" do
visit("users/new") visit("users/new")
fill_in("user[name]", with: "New User") fill_in("user[name]", with: "New User")
click_button("Continue") click_button("Continue")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_content(/Enter an email address/) expect(page).to have_content(/Enter an email address/)
expect(page).to have_title("Error") expect(page).to have_title("Error")
@ -390,7 +390,7 @@ RSpec.describe "User Features" do
fill_in("user[name]", with: "New User") fill_in("user[name]", with: "New User")
fill_in("user[email]", with: "thisis'tanemail") fill_in("user[email]", with: "thisis'tanemail")
click_button("Continue") click_button("Continue")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_content(/Enter an email address in the correct format, like name@example.com/) expect(page).to have_content(/Enter an email address in the correct format, like name@example.com/)
expect(page).to have_title("Error") expect(page).to have_title("Error")
@ -676,7 +676,7 @@ RSpec.describe "User Features" do
expect(page).to have_content("Check your email") expect(page).to have_content("Check your email")
expect(page).to have_http_status(:unprocessable_entity) expect(page).to have_http_status(:unprocessable_entity)
expect(page).to have_title("Error") expect(page).to have_title("Error")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
end end
end end
end end
@ -689,7 +689,7 @@ RSpec.describe "User Features" do
expect(page).to have_content("Check your email") expect(page).to have_content("Check your email")
expect(page).to have_http_status(:unprocessable_entity) expect(page).to have_http_status(:unprocessable_entity)
expect(page).to have_title("Error") expect(page).to have_title("Error")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
end end
end end
@ -747,7 +747,7 @@ RSpec.describe "User Features" do
it "is shown an error message if they submit without entering an email address" do it "is shown an error message if they submit without entering an email address" do
visit("/account/password/new") visit("/account/password/new")
click_button("Send email") click_button("Send email")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_selector("#user-email-field-error") expect(page).to have_selector("#user-email-field-error")
expect(page).to have_title("Error") expect(page).to have_title("Error")
end end

2
spec/requests/auth/confirmations_controller_spec.rb

@ -81,7 +81,7 @@ RSpec.describe Auth::ConfirmationsController, type: :request do
it "does not show an error message" do it "does not show an error message" do
follow_redirect! follow_redirect!
expect(page).not_to have_selector("#error-summary-title") expect(page).not_to have_selector(".govuk-error-summary__title")
end end
end end
end end

8
spec/requests/users_controller_spec.rb

@ -66,7 +66,7 @@ RSpec.describe UsersController, type: :request do
it "shows an error on the same page if passwords don't match" do it "shows an error on the same page if passwords don't match" do
expect(response).to have_http_status(:unprocessable_entity) expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_css("h1", class: "govuk-heading-l", text: "Change your password") expect(page).to have_css("h1", class: "govuk-heading-l", text: "Change your password")
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_content("passwords you entered do not match") expect(page).to have_content("passwords you entered do not match")
end end
end end
@ -351,7 +351,7 @@ RSpec.describe UsersController, type: :request do
it "shows an error if passwords don't match" do it "shows an error if passwords don't match" do
expect(response).to have_http_status(:unprocessable_entity) expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
end end
end end
end end
@ -776,7 +776,7 @@ RSpec.describe UsersController, type: :request do
it "shows an error if passwords don't match" do it "shows an error if passwords don't match" do
expect(response).to have_http_status(:unprocessable_entity) expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
end end
end end
end end
@ -1732,7 +1732,7 @@ RSpec.describe UsersController, type: :request do
it "shows an error if passwords don't match" do it "shows an error if passwords don't match" do
expect(response).to have_http_status(:unprocessable_entity) expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_selector("#error-summary-title") expect(page).to have_selector(".govuk-error-summary__title")
end end
end end
end end

Loading…
Cancel
Save