From ea1d31f18ab555ffea29d4a1d38e5329cb7d3927 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 8 Jan 2024 12:06:45 +0000 Subject: [PATCH] More tweaks --- .../bulk_upload_error_row_component.html.erb | 4 ++-- ...oad_error_summary_table_component.html.erb | 4 ++-- app/helpers/data_sharing_agreement_helper.rb | 2 +- app/views/layouts/application.html.erb | 4 ++-- .../logs/_delete_logs_table_lettings.html.erb | 4 ++-- .../logs/_delete_logs_table_sales.html.erb | 4 ++-- app/views/logs/index.html.erb | 2 +- app/views/logs/update_logs.html.erb | 4 ++-- spec/features/form/form_navigation_spec.rb | 8 +++---- spec/features/form/validations_spec.rb | 4 ++-- spec/features/user_spec.rb | 22 +++++++++---------- .../auth/confirmations_controller_spec.rb | 2 +- spec/requests/users_controller_spec.rb | 8 +++---- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/app/components/bulk_upload_error_row_component.html.erb b/app/components/bulk_upload_error_row_component.html.erb index 463272726..907c73298 100644 --- a/app/components/bulk_upload_error_row_component.html.erb +++ b/app/components/bulk_upload_error_row_component.html.erb @@ -9,7 +9,7 @@
<%= govuk_table do |table| %> - <% table.with_head do |head| %> + <%= table.with_head do |head| %> <% head.with_row do |row| %> <% row.with_cell(header: true, text: "Cell") %> <% row.with_cell(header: true, text: "Question") %> @@ -17,7 +17,7 @@ <% row.with_cell(header: true, text: "Specification") %> <% end %> - <% table.with_body do |body| %> + <%= table.with_body do |body| %> <% bulk_upload_errors.each do |error| %> <% body.with_row do |row| %> <% row.with_cell(header: true, text: error.cell) %> diff --git a/app/components/bulk_upload_error_summary_table_component.html.erb b/app/components/bulk_upload_error_summary_table_component.html.erb index 54348475c..ccd7e0e98 100644 --- a/app/components/bulk_upload_error_summary_table_component.html.erb +++ b/app/components/bulk_upload_error_summary_table_component.html.erb @@ -4,13 +4,13 @@ <% sorted_errors.each do |error| %> <%= govuk_table do |table| %> - <% table.with_head do |head| %> + <%= table.with_head do |head| %> <% head.with_row do |row| %> <% 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) %> <% end %> - <% table.body do |body| %> + <%= table.body do |body| %> <% body.with_row do |row| %> <% row.with_cell(text: error[0][2]) %> <% row.with_cell(text: pluralize(error[1], "error"), numeric: true) %> diff --git a/app/helpers/data_sharing_agreement_helper.rb b/app/helpers/data_sharing_agreement_helper.rb index 283f5abd8..79296e6dc 100644 --- a/app/helpers/data_sharing_agreement_helper.rb +++ b/app/helpers/data_sharing_agreement_helper.rb @@ -7,7 +7,7 @@ module DataSharingAgreementHelper text: "View agreement", ) - row.value do + row.with_value do simple_format( data_sharing_agreement_first_line(organisation:, user:), wrapper_tag: "span", diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 826eac676..6a76185c3 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -87,7 +87,7 @@ <%= govuk_header( 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", ) do |component| component.with_product_name(name: t("service_name")) @@ -126,7 +126,7 @@ success: true, title_heading_level: 3, title_id: "swanky-notifications" ) 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] tag.p flash[:notification_banner_body]&.html_safe end diff --git a/app/views/logs/_delete_logs_table_lettings.html.erb b/app/views/logs/_delete_logs_table_lettings.html.erb index 570f3ebb3..a56de235a 100644 --- a/app/views/logs/_delete_logs_table_lettings.html.erb +++ b/app/views/logs/_delete_logs_table_lettings.html.erb @@ -1,5 +1,5 @@ <%= govuk_table do |table| %> - <% table.with_head do |head| %> + <%= table.with_head do |head| %> <% head.with_row do |row| %> <% row.with_cell header: true, text: "Log ID" %> <% row.with_cell header: true, text: "Tenancy code" %> @@ -8,7 +8,7 @@ <% row.with_cell header: true, text: "Delete?" %> <% end %> <% end %> - <% table.with_body do |body| %> + <%= table.with_body do |body| %> <% f.govuk_check_boxes_fieldset :selected_ids, small: true do %> <% delete_logs_form.logs.each do |log| %> <% body.with_row do |row| %> diff --git a/app/views/logs/_delete_logs_table_sales.html.erb b/app/views/logs/_delete_logs_table_sales.html.erb index 7c2cfe627..612de52de 100644 --- a/app/views/logs/_delete_logs_table_sales.html.erb +++ b/app/views/logs/_delete_logs_table_sales.html.erb @@ -1,5 +1,5 @@ <%= govuk_table do |table| %> - <% table.with_head do |head| %> + <%= table.with_head do |head| %> <% head.with_row do |row| %> <% row.with_cell header: true, text: "Log ID" %> <% row.with_cell header: true, text: "Purchaser code" %> @@ -8,7 +8,7 @@ <% row.with_cell header: true, text: "Delete?" %> <% end %> <% end %> - <% table.with_body do |body| %> + <%= table.with_body do |body| %> <% f.govuk_check_boxes_fieldset :selected_ids, small: true do %> <% delete_logs_form.logs.each do |log| %> <% body.with_row do |row| %> diff --git a/app/views/logs/index.html.erb b/app/views/logs/index.html.erb index 66f50c3d7..f142a2580 100644 --- a/app/views/logs/index.html.erb +++ b/app/views/logs/index.html.erb @@ -27,7 +27,7 @@ title_heading_level: 3, title_id: "impacted-logs-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)}") %>
<%= govuk_link_to "Update logs", update_logs_lettings_logs_path, class: "govuk-notification-banner__link" %>
diff --git a/app/views/logs/update_logs.html.erb b/app/views/logs/update_logs.html.erb index c5824827e..1ab1fa31c 100644 --- a/app/views/logs/update_logs.html.erb +++ b/app/views/logs/update_logs.html.erb @@ -14,7 +14,7 @@ <% else %> <%= render partial: "organisations/headings", locals: { main: "You need to update #{@total_count} logs", sub: "" } %> <%= govuk_table do |table| %> - <% table.with_head do |head| %> + <%= table.with_head do |head| %> <% head.with_row do |row| %> <% row.with_cell(header: true, text: "Log ID") %> <% row.with_cell(header: true, text: "Tenancy code") %> @@ -24,7 +24,7 @@ <% end %> <% end %> <% @logs.each do |log| %> - <% table.with_body do |body| %> + <%= table.with_body do |body| %> <% body.with_row do |row| %> <% row.with_cell(text: log.id) %> <% row.with_cell(text: log.tenancycode) %> diff --git a/spec/features/form/form_navigation_spec.rb b/spec/features/form/form_navigation_spec.rb index a5784d1ec..d248fbfcc 100644 --- a/spec/features/form/form_navigation_spec.rb +++ b/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 visit("/lettings-logs/#{id}/renewal") 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_title("Error") end @@ -145,7 +145,7 @@ RSpec.describe "Form Navigation" do it "shows a validation error on date questions" do visit("/lettings-logs/#{id}/tenancy-start-date") 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_title("Error") end @@ -156,7 +156,7 @@ RSpec.describe "Form Navigation" do visit("/lettings-logs/#{id}/armed-forces") choose("lettings-log-armedforces-1-field", allow_label_click: true) 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_title("Error") end @@ -170,7 +170,7 @@ RSpec.describe "Form Navigation" do it "does not show a validation error" do visit("/lettings-logs/#{id}/tenant-code") 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).to have_current_path("/lettings-logs/#{id}/property-reference") end diff --git a/spec/features/form/validations_spec.rb b/spec/features/form/validations_spec.rb index 48bafbf9a..aecb0c995 100644 --- a/spec/features/form/validations_spec.rb +++ b/spec/features/form/validations_spec.rb @@ -55,7 +55,7 @@ RSpec.describe "validations" do it "shows validation for under 0" do visit("/lettings-logs/#{id}/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-field-error") expect(page).to have_title("Error") @@ -64,7 +64,7 @@ RSpec.describe "validations" do it "shows validation for over 120" do visit("/lettings-logs/#{id}/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-field-error") expect(page).to have_title("Error") diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 2da53970b..01a32de5c 100644 --- a/spec/features/user_spec.rb +++ b/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 visit("/account/password/new") 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_title("Error") end @@ -74,7 +74,7 @@ RSpec.describe "User Features" do visit("/account/password/new") fill_in("user[email]", with: "thisisn'tanemail") 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_title("Error") end @@ -166,7 +166,7 @@ RSpec.describe "User Features" do fill_in("user[email]", with: user.email) fill_in("user[password]", with: "nonsense") 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_title("Error") end @@ -174,7 +174,7 @@ RSpec.describe "User Features" do it "show specific field error messages if a field was omitted" do visit("/lettings-logs") 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-password-field-error") expect(page).to have_title("Error") @@ -184,7 +184,7 @@ RSpec.describe "User Features" do visit("/lettings-logs") fill_in("user[email]", with: "thisisn'tanemail") 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_content(/Enter an email address in the correct format, like name@example.com/) 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[password]", with: "pAssword1") 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_title("Error") end @@ -379,7 +379,7 @@ RSpec.describe "User Features" do visit("users/new") fill_in("user[name]", with: "New User") 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_content(/Enter an email address/) 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[email]", with: "thisis'tanemail") 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_content(/Enter an email address in the correct format, like name@example.com/) 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_http_status(:unprocessable_entity) 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 @@ -689,7 +689,7 @@ RSpec.describe "User Features" do expect(page).to have_content("Check your email") expect(page).to have_http_status(:unprocessable_entity) 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 @@ -747,7 +747,7 @@ RSpec.describe "User Features" do it "is shown an error message if they submit without entering an email address" do visit("/account/password/new") 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_title("Error") end diff --git a/spec/requests/auth/confirmations_controller_spec.rb b/spec/requests/auth/confirmations_controller_spec.rb index d734fed8c..7d0bc1b41 100644 --- a/spec/requests/auth/confirmations_controller_spec.rb +++ b/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 follow_redirect! - expect(page).not_to have_selector("#error-summary-title") + expect(page).not_to have_selector(".govuk-error-summary__title") end end end diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 7f1b3ffef..90b49c2be 100644 --- a/spec/requests/users_controller_spec.rb +++ b/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 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_selector("#error-summary-title") + expect(page).to have_selector(".govuk-error-summary__title") expect(page).to have_content("passwords you entered do not match") end end @@ -351,7 +351,7 @@ RSpec.describe UsersController, type: :request do it "shows an error if passwords don't match" do 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 @@ -776,7 +776,7 @@ RSpec.describe UsersController, type: :request do it "shows an error if passwords don't match" do 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 @@ -1732,7 +1732,7 @@ RSpec.describe UsersController, type: :request do it "shows an error if passwords don't match" do 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