diff --git a/app/assets/stylesheets/_task_list.scss b/app/assets/stylesheets/_task_list.scss deleted file mode 100644 index dca012f558..0000000000 --- a/app/assets/stylesheets/_task_list.scss +++ /dev/null @@ -1,70 +0,0 @@ -.app-task-list { - list-style-type: none; - padding-left: 0; - margin-top: 0; - margin-bottom: 0; - @include govuk-media-query($from: tablet) { - min-width: 550px; - } -} - -.app-task-list__section { - display: table; - @include govuk-font($size: 24, $weight: bold); -} - -.app-task-list__section-number { - display: table-cell; - - @include govuk-media-query($from: tablet) { - min-width: govuk-spacing(6); - padding-right: 0; - } -} - -.app-task-list__items-no-indentation { - @include govuk-font($size: 19); - @include govuk-responsive-margin(9, "bottom"); - list-style: none; - padding-left: 0; -} - -.app-task-list__items { - @include govuk-font($size: 19); - @include govuk-responsive-margin(9, "bottom"); - list-style: none; - padding-left: 0; - @include govuk-media-query($from: tablet) { - padding-left: govuk-spacing(6); - } -} - -.app-task-list__item { - border-bottom: 1px solid $govuk-border-colour; - margin-bottom: 0 !important; - padding-top: govuk-spacing(2); - padding-bottom: govuk-spacing(2); - @include govuk-clearfix; -} - -.app-task-list__item:first-child { - border-top: 1px solid $govuk-border-colour; -} - -.app-task-list__task-name { - display: block; - @include govuk-media-query($from: 450px) { - float: left; - } -} - -.app-task-list__tag { - margin-top: govuk-spacing(2); - margin-bottom: govuk-spacing(1); - - @include govuk-media-query($from: 450px) { - float: right; - margin-top: 0; - margin-bottom: 0; - } -} diff --git a/app/assets/stylesheets/application.sass.scss b/app/assets/stylesheets/application.sass.scss index eb30b93f04..7ad54209ad 100644 --- a/app/assets/stylesheets/application.sass.scss +++ b/app/assets/stylesheets/application.sass.scss @@ -16,7 +16,6 @@ $moj-images-path: "/"; @import "_environments"; @import "_search_results"; @import "_support"; -@import "_task_list"; ul.autocomplete__menu { li { diff --git a/app/components/task_list/component.html.erb b/app/components/task_list/component.html.erb deleted file mode 100644 index a5b35fe21b..0000000000 --- a/app/components/task_list/component.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -
    - <% sections.each do |section| %> -
  1. - <% if (title = section[:title]).present? %> -

    - <% if sections.count > 1 %> - <%= section[:number] %>. - <% end %> - - <%= title %> -

    - <% end %> - - -
  2. - <% end %> -
diff --git a/app/components/task_list/component.rb b/app/components/task_list/component.rb deleted file mode 100644 index ac12461ce6..0000000000 --- a/app/components/task_list/component.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module TaskList - class Component < ViewComponent::Base - ## - # Renders a task list from the following data structure: - # - # sections: [ - # { - # title: "Title", - # items: [ - # { - # name: "Do this thing", - # link: "/do-this-thing", - # status: "not_started" - # } - # ] - # } - # ] - - def initialize(sections) - super - @sections = sections - end - - def sections - @sections - .filter { |section| section[:items].present? } - .each_with_index - .map do |section, index| - section.merge( - number: index + 1, - key: section[:title]&.parameterize, - items: - section[:items].map do |item| - item.merge(key: item[:name].parameterize) - end, - ) - end - end - end -end diff --git a/app/view_objects/teacher_interface/further_information_request_view_object.rb b/app/view_objects/teacher_interface/further_information_request_view_object.rb index 2708f1be76..04fe743939 100644 --- a/app/view_objects/teacher_interface/further_information_request_view_object.rb +++ b/app/view_objects/teacher_interface/further_information_request_view_object.rb @@ -15,26 +15,23 @@ def further_information_request .find(params[:id]) end - def task_list_sections - items = - further_information_request - .items - .order(:created_at) - .map do |item| - { - name: item_name(item), - link: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - item, - ], - status: item.state, - } - end - - [{ title: "Further information requested", items: }] + def task_list_items + further_information_request + .items + .order(:created_at) + .map do |item| + { + title: item_name(item), + href: [ + :edit, + :teacher_interface, + :application_form, + further_information_request, + item, + ], + status: item.state, + } + end end def can_check_answers? diff --git a/app/views/assessor_interface/application_forms/show.html.erb b/app/views/assessor_interface/application_forms/show.html.erb index e9b268d84f..8dd236bd2e 100644 --- a/app/views/assessor_interface/application_forms/show.html.erb +++ b/app/views/assessor_interface/application_forms/show.html.erb @@ -30,4 +30,14 @@

Task list

-<%= render(TaskList::Component.new(@view_object.task_list_sections)) %> +<% @view_object.task_list_sections.each do |section| %> + <% if (items = section[:items]).present? %> +

<%= section[:title] %>

+ + <%= govuk_task_list(id_prefix: section[:title].parameterize) do |task_list| + items.each do |item| + task_list.with_item(title: item[:name], href: item[:link], status: render(StatusTag::Component.new(item[:status]))) + end + end %> + <% end %> +<% end %> diff --git a/app/views/assessor_interface/assessments/review.html.erb b/app/views/assessor_interface/assessments/review.html.erb index 4e409b7bf8..fbc8ccc7e9 100644 --- a/app/views/assessor_interface/assessments/review.html.erb +++ b/app/views/assessor_interface/assessments/review.html.erb @@ -7,48 +7,41 @@ The following verification tasks have been flagged for review:

-<%= render(TaskList::Component.new([ - if @professional_standing_request.present? - { - title: "LoPS", - indentation: false, - items: [ - { - name: region_teaching_authority_name(@application_form.region, context: :assessor).upcase_first, - link: [:review, :assessor_interface, @application_form, @assessment, :professional_standing_request], - status: @professional_standing_request.review_status, - } - ], - } - end, - if @qualification_requests.present? - { - title: "Qualifications", - indentation: false, - items: @qualification_requests.map do |qualification_request| - { - name: qualification_title(qualification_request.qualification), - link: [:review, :assessor_interface, @application_form, @assessment, qualification_request], - status: qualification_request.review_status, - } - end - } - end, - if @reference_requests.present? - { - title: "References", - indentation: false, - items: @reference_requests.map do |reference_request| - { - name: work_history_name(reference_request.work_history), - link: [:review, :assessor_interface, @application_form, @assessment, reference_request], - status: reference_request.review_status, - } - end - } - end -].compact)) %> +<% if @professional_standing_request.present? %> +

LoPS

+ <%= govuk_task_list(id_prefix: "lops") do |task_list| + task_list.with_item( + title: region_teaching_authority_name(@application_form.region, context: :assessor).upcase_first, + href: [:review, :assessor_interface, @application_form, @assessment, :professional_standing_request], + status: render(StatusTag::Component.new(@professional_standing_request.review_status)), + ) + end %> +<% end %> -
- <%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> -
+<% if @qualification_requests.present? %> +

Qualifications

+ <%= govuk_task_list(id_prefix: "qualifications") do |task_list| + @qualification_requests.each do |qualification_request| + task_list.with_item( + title: qualification_title(qualification_request.qualification), + href: [:review, :assessor_interface, @application_form, @assessment, qualification_request], + status: render(StatusTag::Component.new(qualification_request.review_status)), + ) + end + end %> +<% end %> + +<% if @reference_requests.present? %> +

References

+ <%= govuk_task_list(id_prefix: "references") do |task_list| + @reference_requests.each do |reference_request| + task_list.with_item( + title: work_history_name(reference_request.work_history), + href: [:review, :assessor_interface, @application_form, @assessment, reference_request], + status: render(StatusTag::Component.new(reference_request.review_status)), + ) + end + end %> +<% end %> + +<%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> diff --git a/app/views/assessor_interface/professional_standing_requests/show.html.erb b/app/views/assessor_interface/professional_standing_requests/show.html.erb index c667af6bd5..037a57330a 100644 --- a/app/views/assessor_interface/professional_standing_requests/show.html.erb +++ b/app/views/assessor_interface/professional_standing_requests/show.html.erb @@ -7,46 +7,40 @@ You need to request verification for this application’s LoPS.

-<%= render(TaskList::Component.new( - [ - { - indentation: false, - items: [ - { - name: "Request LoPS verification", - link: unless @professional_standing_request.requested? - [ - :request, - :assessor_interface, - @application_form, - @assessment, - :professional_standing_request, - ] - end, - status: @professional_standing_request.requested? ? "completed" : "not_started" - }, - { - name: "Record LoPS response", - link: if @professional_standing_request.requested? - [ - :verify, - :assessor_interface, - @application_form, - @assessment, - :professional_standing_request - ] - end, - status: if @professional_standing_request.verify_passed? - "completed" - elsif @professional_standing_request.requested? - @professional_standing_request.status - else - "cannot_start" - end - } - ], - } - ] -)) %> +<%= govuk_task_list do |task_list| + task_list.with_item( + title: "Request LoPS verification", + href: unless @professional_standing_request.requested? + [ + :request, + :assessor_interface, + @application_form, + @assessment, + :professional_standing_request, + ] + end, + status: render(StatusTag::Component.new(@professional_standing_request.requested? ? "completed" : "not_started")) + ) + + task_list.with_item( + title: "Record LoPS response", + href: if @professional_standing_request.requested? + [ + :verify, + :assessor_interface, + @application_form, + @assessment, + :professional_standing_request + ] + end, + status: render(StatusTag::Component.new(if @professional_standing_request.verify_passed? + "completed" + elsif @professional_standing_request.requested? + @professional_standing_request.status + else + "cannot_start" + end)) + ) +end %> <%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> diff --git a/app/views/assessor_interface/qualification_requests/index.html.erb b/app/views/assessor_interface/qualification_requests/index.html.erb index d844c06a7e..eeb9c7539d 100644 --- a/app/views/assessor_interface/qualification_requests/index.html.erb +++ b/app/views/assessor_interface/qualification_requests/index.html.erb @@ -3,20 +3,16 @@ <%= render "shared/assessor_header", title: t("assessor_interface.application_forms.show.assessment_tasks.items.qualification_requests"), application_form: @application_form %> -<%= render TaskList::Component.new( - [ - { - title: "Qualifications", - indentation: false, - items: @qualification_requests.map do |qualification_request| - { - name: qualification_title(qualification_request.qualification), - link: [:edit, :assessor_interface, @application_form, @assessment, qualification_request], - status: qualification_request.status - } - end - } - ] -) %> +

Qualifications

+ +<%= govuk_task_list do |task_list| + @qualification_requests.each do |qualification_request| + task_list.with_item( + title: qualification_title(qualification_request.qualification), + href: [:edit, :assessor_interface, @application_form, @assessment, qualification_request], + status: render(StatusTag::Component.new(qualification_request.status)) + ) + end +end %> <%= govuk_button_link_to "Back to overview", [:assessor_interface, @application_form] %> diff --git a/app/views/assessor_interface/reference_requests/index.html.erb b/app/views/assessor_interface/reference_requests/index.html.erb index a5027c655b..c7f090aad1 100644 --- a/app/views/assessor_interface/reference_requests/index.html.erb +++ b/app/views/assessor_interface/reference_requests/index.html.erb @@ -8,19 +8,17 @@ You can review those that have the status RECEIVED.

-<%= render TaskList::Component.new([ - { - title: "References to verify", - indentation: false, - items: @reference_requests.map do |reference_request| - { - name: work_history_name_and_duration(reference_request.work_history), - link: [:verify, :assessor_interface, @application_form, @assessment, reference_request], - status: reference_request.status - } - end - } -]) %> +

References to verify

+ +<%= govuk_task_list do |task_list| + @reference_requests.each do |reference_request| + task_list.with_item( + title: work_history_name_and_duration(reference_request.work_history), + href: [:verify, :assessor_interface, @application_form, @assessment, reference_request], + status: render(StatusTag::Component.new(reference_request.status)) + ) + end +end %> <% if @assessment.enough_reference_requests_verify_passed? || @assessment.all_reference_requests_verified? %> <%= govuk_button_link_to "Continue", [:assessor_interface, @application_form] %> diff --git a/app/views/teacher_interface/application_forms/show/_draft.html.erb b/app/views/teacher_interface/application_forms/show/_draft.html.erb index 5c510ac00c..18a308c153 100644 --- a/app/views/teacher_interface/application_forms/show/_draft.html.erb +++ b/app/views/teacher_interface/application_forms/show/_draft.html.erb @@ -34,7 +34,15 @@ <% end %> <% end %> -<%= render TaskList::Component.new(view_object.task_list_sections) %> +<% view_object.task_list_sections.each do |section| %> +

<%= section[:title] %>

+ + <%= govuk_task_list(id_prefix: section[:title].parameterize) do |task_list| + section[:items].each do |item| + task_list.with_item(title: item[:name], href: item[:link], status: render(StatusTag::Component.new(item[:status]))) + end + end %> +<% end %>
<% if view_object.can_submit? %> diff --git a/app/views/teacher_interface/further_information_requests/show.html.erb b/app/views/teacher_interface/further_information_requests/show.html.erb index fb3242a210..fd8cad0baf 100644 --- a/app/views/teacher_interface/further_information_requests/show.html.erb +++ b/app/views/teacher_interface/further_information_requests/show.html.erb @@ -3,12 +3,17 @@

Apply for qualified teacher status (QTS)

-<%= render TaskList::Component.new(@view_object.task_list_sections) %> +

Further information requested

+ +<%= govuk_task_list do |task_list| + @view_object.task_list_items.each do |item| + task_list.with_item(title: item[:title], href: item[:href], status: render(StatusTag::Component.new(item[:status]))) + end +end %> <% if @view_object.can_check_answers? %>

Once you’ve checked your response on the next screen, you’ll be able to submit it.

- <%= govuk_button_link_to t("teacher_interface.further_information_request.show.check"), edit_teacher_interface_application_form_further_information_request_path(@view_object.further_information_request) %> + <%= govuk_button_link_to t("teacher_interface.further_information_request.show.check"), [:edit, :teacher_interface, :application_form, @view_object.further_information_request] %> <% end %> - <%= govuk_button_link_to t("teacher_interface.application_forms.show.draft.save"), destroy_teacher_session_path, secondary: true %> diff --git a/app/views/teacher_interface/qualification_requests/index.html.erb b/app/views/teacher_interface/qualification_requests/index.html.erb index 96cc62cd37..18e38d3688 100644 --- a/app/views/teacher_interface/qualification_requests/index.html.erb +++ b/app/views/teacher_interface/qualification_requests/index.html.erb @@ -3,7 +3,15 @@

Consent documents overview

-<%= render(TaskList::Component.new(@view_object.task_list_sections)) %> +<% @view_object.task_list_sections.each do |section| %> +

<%= section[:title] %>

+ + <%= govuk_task_list(id_prefix: section[:title].parameterize) do |task_list| + section[:items].each do |item| + task_list.with_item(title: item[:name], href: item[:link], status: render(StatusTag::Component.new(item[:status]))) + end + end %> +<% end %>
<% if @view_object.can_submit? %> diff --git a/spec/components/task_list_spec.rb b/spec/components/task_list_spec.rb deleted file mode 100644 index 66d413b8de..0000000000 --- a/spec/components/task_list_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -RSpec.describe TaskList::Component, type: :component do - subject(:component) { render_inline(described_class.new(sections)) } - - let(:sections) do - [ - { - title: "Section A", - items: [{ name: "Item A", href: "/item-a", status: "not_started" }], - }, - { title: "Section B", items: [{ name: "Item B", status: "completed" }] }, - ] - end - - it "numbers the section titles" do - expect(component.text.squish).to include("1. Section A") - expect(component.text.squish).to include("2. Section B") - end - - it "shows the item statuses" do - expect(component.text.squish).to include("Item A Not started") - expect(component.text.squish).to include("Item B Completed") - end -end diff --git a/spec/support/autoload/page_objects/assessor_interface/application.rb b/spec/support/autoload/page_objects/assessor_interface/application.rb index c9cfe323e3..b464abb922 100644 --- a/spec/support/autoload/page_objects/assessor_interface/application.rb +++ b/spec/support/autoload/page_objects/assessor_interface/application.rb @@ -10,11 +10,7 @@ class Application < SitePrism::Page element :add_note_button, ".app-inline-action .govuk-button" section :summary_list, GovukSummaryList, ".govuk-summary-list" - section :task_list, TaskList, ".app-task-list" - - section :management_tasks, ".app-task-list + .govuk-warning-text" do - elements :links, ".govuk-link" - end + sections :task_lists, GovukTaskList, ".govuk-task-list" def name_summary summary_list.find_row(key: "Name") @@ -32,68 +28,72 @@ def status_summary summary_list.find_row(key: "Status") end + def find_task_list_item(name) + task_lists.map { |task_list| task_list.find_item(name) }.compact.first + end + def preliminary_check_task - task_list.find_item("Preliminary check (qualifications)") + find_task_list_item("Preliminary check (qualifications)") end def awaiting_professional_standing_task - task_list.find_item("Awaiting third-party professional standing") + find_task_list_item("Awaiting third-party professional standing") end def personal_information_task - task_list.find_item("Check personal information") + find_task_list_item("Check personal information") end def qualifications_task - task_list.find_item("Check qualifications") + find_task_list_item("Check qualifications") end def age_range_subjects_task - task_list.find_item("Verify age range and subjects") + find_task_list_item("Verify age range and subjects") end def english_language_proficiency_task - task_list.find_item("Check English language proficiency") + find_task_list_item("Check English language proficiency") end def work_history_task - task_list.find_item("Check work history") + find_task_list_item("Check work history") end def professional_standing_task - task_list.find_item("Check professional standing") + find_task_list_item("Check professional standing") end def review_requested_information_task - task_list.find_item("Review requested information from applicant") + find_task_list_item("Review requested information from applicant") end def record_qualification_requests_task - task_list.find_item("Record qualifications responses") + find_task_list_item("Record qualifications responses") end def review_qualification_requests_task - task_list.find_item("Review qualifications responses") + find_task_list_item("Review qualifications responses") end def verify_references_task - task_list.find_item("Verify references") + find_task_list_item("Verify references") end def verify_professional_standing_task - task_list.find_item("Verify LoPS") + find_task_list_item("Verify LoPS") end def assessment_decision_task - task_list.find_item("Assessment decision") + find_task_list_item("Assessment decision") end def review_verifications_task - task_list.find_item("Review verifications") + find_task_list_item("Review verifications") end def verification_decision_task - task_list.find_item("Verification decision") + find_task_list_item("Verification decision") end end end diff --git a/spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb b/spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb index c8c2af925b..84cab78b33 100644 --- a/spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb +++ b/spec/support/autoload/page_objects/assessor_interface/professional_standing_request.rb @@ -6,7 +6,7 @@ class ProfessionalStandingRequest < SitePrism::Page set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \ "/professional-standing-request" - section :task_list, TaskList, ".app-task-list" + section :task_list, GovukTaskList, ".govuk-task-list" element :status_tag, ".govuk-tag" def request_lops_verification_task diff --git a/spec/support/autoload/page_objects/assessor_interface/qualification_requests.rb b/spec/support/autoload/page_objects/assessor_interface/qualification_requests.rb index 9972942a15..982ed9522d 100644 --- a/spec/support/autoload/page_objects/assessor_interface/qualification_requests.rb +++ b/spec/support/autoload/page_objects/assessor_interface/qualification_requests.rb @@ -6,10 +6,7 @@ class QualificationRequests < SitePrism::Page set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \ "/qualification-requests" - section :task_list, ".app-task-list__item" do - elements :qualification_requests, ".app-task-list__task-name a" - elements :status_tags, ".app-task-list__tag" - end + section :task_list, GovukTaskList, ".govuk-task-list" element :continue_button, ".govuk-button:not(.govuk-button--secondary)" end diff --git a/spec/support/autoload/page_objects/assessor_interface/reference_requests.rb b/spec/support/autoload/page_objects/assessor_interface/reference_requests.rb index 12559cb438..0d72788eea 100644 --- a/spec/support/autoload/page_objects/assessor_interface/reference_requests.rb +++ b/spec/support/autoload/page_objects/assessor_interface/reference_requests.rb @@ -6,7 +6,7 @@ class ReferenceRequests < SitePrism::Page set_url "/assessor/applications/{reference}/assessments/{assessment_id}" \ "/reference-requests" - section :task_list, TaskList, ".app-task-list" + section :task_list, GovukTaskList, ".govuk-task-list" element :continue_button, ".govuk-button:not(.govuk-button--secondary)" end diff --git a/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb b/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb index a3b6f3b4fe..f0b0c7c24a 100644 --- a/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb +++ b/spec/support/autoload/page_objects/assessor_interface/review_verifications.rb @@ -5,7 +5,7 @@ module AssessorInterface class ReviewVerifications < SitePrism::Page set_url "/assessor/applications/{reference}/assessments/{assessment_id}/review" - section :task_list, TaskList, ".app-task-list" + section :task_list, GovukTaskList, ".govuk-task-list" element :back_to_overview_button, ".govuk-button" end diff --git a/spec/support/autoload/page_objects/govuk_task_list.rb b/spec/support/autoload/page_objects/govuk_task_list.rb new file mode 100644 index 0000000000..d18eaa9973 --- /dev/null +++ b/spec/support/autoload/page_objects/govuk_task_list.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module PageObjects + class GovukTaskList < SitePrism::Section + sections :items, ".govuk-task-list__item" do + section :name_and_hint, ".govuk-task-list__name-and-hint" do + element :link, "a" + end + element :status_tag, ".govuk-tag" + end + + def find_item(text) + items.find { |item| item.name_and_hint.text == text } + end + + def click_item(link_text) + find_item(link_text).click + end + end +end diff --git a/spec/support/autoload/page_objects/task_list.rb b/spec/support/autoload/page_objects/task_list.rb deleted file mode 100644 index 1a342923ca..0000000000 --- a/spec/support/autoload/page_objects/task_list.rb +++ /dev/null @@ -1,13 +0,0 @@ -module PageObjects - class TaskList < SitePrism::Section - sections :sections, TaskListSection, ".app-task-list > li" - - def find_item(text) - sections.flat_map(&:items).find { |item| item.name.text == text } - end - - def click_item(link_text) - find_item(link_text).click - end - end -end diff --git a/spec/support/autoload/page_objects/task_list_item.rb b/spec/support/autoload/page_objects/task_list_item.rb deleted file mode 100644 index a4ba2c2d8a..0000000000 --- a/spec/support/autoload/page_objects/task_list_item.rb +++ /dev/null @@ -1,9 +0,0 @@ -module PageObjects - class TaskListItem < SitePrism::Section - element :name, "span" - element :link, "a" - element :status_tag, ".govuk-tag" - - def_delegator :link, :click - end -end diff --git a/spec/support/autoload/page_objects/task_list_section.rb b/spec/support/autoload/page_objects/task_list_section.rb deleted file mode 100644 index 08981f2f9f..0000000000 --- a/spec/support/autoload/page_objects/task_list_section.rb +++ /dev/null @@ -1,6 +0,0 @@ -module PageObjects - class TaskListSection < SitePrism::Section - element :heading, "h2" - sections :items, TaskListItem, ".app-task-list__item" - end -end diff --git a/spec/support/autoload/page_objects/teacher_interface/application.rb b/spec/support/autoload/page_objects/teacher_interface/application.rb index 5a9469baac..9007708179 100644 --- a/spec/support/autoload/page_objects/teacher_interface/application.rb +++ b/spec/support/autoload/page_objects/teacher_interface/application.rb @@ -11,42 +11,46 @@ class Application < SitePrism::Page element :save_and_sign_out, ".govuk-button.govuk-button--secondary" element :start_now_button, ".govuk-button:not(.govuk-button--secondary)" - section :task_list, TaskList, ".app-task-list" + sections :task_lists, GovukTaskList, ".govuk-task-list" + + def find_task_list_item(name) + task_lists.map { |task_list| task_list.find_item(name) }.compact.first + end def personal_information_task_item - task_list.find_item("Enter your personal information") + find_task_list_item("Enter your personal information") end def qualifications_task_item - task_list.find_item("Add your teaching qualifications") + find_task_list_item("Add your teaching qualifications") end def age_range_task_item - task_list.find_item("Enter the age range you can teach") + find_task_list_item("Enter the age range you can teach") end def subjects_task_item - task_list.find_item("Enter the subjects you can teach") + find_task_list_item("Enter the subjects you can teach") end def english_language_task_item - task_list.find_item("Verify your English language proficiency") + find_task_list_item("Verify your English language proficiency") end def work_history_task_item - task_list.find_item("Add your work history") + find_task_list_item("Add your work history") end def registration_number_task_item - task_list.find_item("Enter your registration number") + find_task_list_item("Enter your registration number") end def upload_written_statement_task_item - task_list.find_item("Upload your written statement") + find_task_list_item("Upload your written statement") end def provide_written_statement_task_item - task_list.find_item("Provide your written statement") + find_task_list_item("Provide your written statement") end end end diff --git a/spec/support/autoload/page_objects/teacher_interface/further_information_requested.rb b/spec/support/autoload/page_objects/teacher_interface/further_information_requested.rb index d4b445209a..b25f0f48b5 100644 --- a/spec/support/autoload/page_objects/teacher_interface/further_information_requested.rb +++ b/spec/support/autoload/page_objects/teacher_interface/further_information_requested.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + module PageObjects module TeacherInterface class FurtherInformationRequested < SitePrism::Page set_url "/teacher/application/further_information_requests/{request_id}" element :heading, ".govuk-heading-l" - section :task_list, TaskList, ".app-task-list" + section :task_list, GovukTaskList, ".govuk-task-list" element :check_your_answers_button, ".govuk-button:not(.govuk-button--secondary)" diff --git a/spec/support/autoload/page_objects/teacher_interface/qualification_requests.rb b/spec/support/autoload/page_objects/teacher_interface/qualification_requests.rb index 53db529dbe..56d28a8970 100644 --- a/spec/support/autoload/page_objects/teacher_interface/qualification_requests.rb +++ b/spec/support/autoload/page_objects/teacher_interface/qualification_requests.rb @@ -5,7 +5,7 @@ module TeacherInterface class QualificationRequests < SitePrism::Page set_url "/teacher/application/qualification-requests" - section :task_list, TaskList, ".app-task-list" + sections :task_lists, GovukTaskList, ".govuk-task-list" element :check_your_answers_button, ".govuk-button:not(.govuk-button--secondary)" diff --git a/spec/system/assessor_interface/checking_submitted_details_spec.rb b/spec/system/assessor_interface/checking_submitted_details_spec.rb index cfa7b8817c..15d4dc4a5f 100644 --- a/spec/system/assessor_interface/checking_submitted_details_spec.rb +++ b/spec/system/assessor_interface/checking_submitted_details_spec.rb @@ -257,12 +257,6 @@ def when_i_choose_check_personal_information_yes assessor_check_personal_information_page.form.continue_button.click end - def personal_information_task_item - assessor_application_page.task_list.tasks.first.items.find do |item| - item.link.text == "Check personal information" - end - end - def and_i_see_check_personal_information_completed expect( assessor_application_page.personal_information_task.status_tag.text, diff --git a/spec/system/assessor_interface/pre_assessment_tasks_spec.rb b/spec/system/assessor_interface/pre_assessment_tasks_spec.rb index 4e03de2322..2833614e59 100644 --- a/spec/system/assessor_interface/pre_assessment_tasks_spec.rb +++ b/spec/system/assessor_interface/pre_assessment_tasks_spec.rb @@ -71,7 +71,7 @@ def and_i_see_a_waiting_on_status end def and_i_see_an_unstarted_preliminary_check_task - expect(assessor_application_page.task_list).to have_content( + expect(assessor_application_page.task_lists.first).to have_content( "Preliminary check (qualifications)", ) expect(assessor_application_page.preliminary_check_task).to have_content( @@ -145,7 +145,7 @@ def and_the_assessor_is_unassigned end def and_i_click_awaiting_professional_standing - assessor_application_page.awaiting_professional_standing_task.link.click + assessor_application_page.awaiting_professional_standing_task.click end def when_i_fill_in_the_locate_form diff --git a/spec/system/assessor_interface/reverse_decision_spec.rb b/spec/system/assessor_interface/reverse_decision_spec.rb index 468685aa1e..a48cec98bb 100644 --- a/spec/system/assessor_interface/reverse_decision_spec.rb +++ b/spec/system/assessor_interface/reverse_decision_spec.rb @@ -39,13 +39,13 @@ def given_there_is_an_application_form end def and_i_see_the_reverse_decision_link - expect(assessor_application_page.task_list).to have_content( + expect(assessor_application_page.task_lists.last).to have_content( "Reverse decision", ) end def when_i_click_on_reverse_decision - assessor_application_page.task_list.click_on("Reverse decision") + assessor_application_page.task_lists.last.click_on("Reverse decision") end def when_i_confirm_the_reversal diff --git a/spec/system/assessor_interface/reviewing_further_information_spec.rb b/spec/system/assessor_interface/reviewing_further_information_spec.rb index 38569fd7e5..46f647858f 100644 --- a/spec/system/assessor_interface/reviewing_further_information_spec.rb +++ b/spec/system/assessor_interface/reviewing_further_information_spec.rb @@ -69,7 +69,7 @@ def given_there_is_further_information_received end def and_i_click_review_requested_information - assessor_application_page.review_requested_information_task.link.click + assessor_application_page.review_requested_information_task.click end def and_i_see_the_check_your_answers_items diff --git a/spec/system/assessor_interface/reviewing_professional_standing_spec.rb b/spec/system/assessor_interface/reviewing_professional_standing_spec.rb index 2f15e9921b..f025e7f5c6 100644 --- a/spec/system/assessor_interface/reviewing_professional_standing_spec.rb +++ b/spec/system/assessor_interface/reviewing_professional_standing_spec.rb @@ -106,7 +106,7 @@ def when_i_click_on_assessment_decision end def when_i_click_on_lops - assessor_application_page.task_list.click_item( + assessor_review_verifications_page.task_list.click_item( "Relevant competent authority", ) end diff --git a/spec/system/assessor_interface/reviewing_qualifications_spec.rb b/spec/system/assessor_interface/reviewing_qualifications_spec.rb index 88cd6105aa..c4460b441d 100644 --- a/spec/system/assessor_interface/reviewing_qualifications_spec.rb +++ b/spec/system/assessor_interface/reviewing_qualifications_spec.rb @@ -106,7 +106,7 @@ def when_i_click_on_assessment_decision end def when_i_click_on_the_qualification - assessor_application_page.task_list.click_item("BSc Teaching") + assessor_review_verifications_page.task_list.click_item("BSc Teaching") end def when_i_submit_yes_on_the_review_form diff --git a/spec/system/assessor_interface/verifying_professional_standing_spec.rb b/spec/system/assessor_interface/verifying_professional_standing_spec.rb index a5a05b0665..40724fe5e4 100644 --- a/spec/system/assessor_interface/verifying_professional_standing_spec.rb +++ b/spec/system/assessor_interface/verifying_professional_standing_spec.rb @@ -179,7 +179,7 @@ def given_the_professional_standing_request_has_expired end def and_i_click_professional_standing_task - assessor_application_page.verify_professional_standing_task.link.click + assessor_application_page.verify_professional_standing_task.click end def when_i_click_request_lops_verification diff --git a/spec/system/assessor_interface/verifying_qualifications_spec.rb b/spec/system/assessor_interface/verifying_qualifications_spec.rb index 6fd6c77ba9..59c9cc57a1 100644 --- a/spec/system/assessor_interface/verifying_qualifications_spec.rb +++ b/spec/system/assessor_interface/verifying_qualifications_spec.rb @@ -86,7 +86,7 @@ def and_i_see_a_waiting_on_status end def and_i_click_record_qualifications_task - assessor_application_page.record_qualification_requests_task.link.click + assessor_application_page.record_qualification_requests_task.click end def when_i_click_review_qualifications_task @@ -94,11 +94,7 @@ def when_i_click_review_qualifications_task end def when_i_select_the_first_qualification_request - assessor_qualification_requests_page - .task_list - .qualification_requests - .first - .click + assessor_qualification_requests_page.task_list.items.first.click end def when_the_request_is_received_and_passed diff --git a/spec/system/assessor_interface/verifying_references_spec.rb b/spec/system/assessor_interface/verifying_references_spec.rb index df3b5a86d0..19c1a2c2c1 100644 --- a/spec/system/assessor_interface/verifying_references_spec.rb +++ b/spec/system/assessor_interface/verifying_references_spec.rb @@ -115,15 +115,17 @@ def and_i_see_a_waiting_on_status end def and_i_click_verify_references - assessor_application_page.verify_references_task.link.click + assessor_application_page.verify_references_task.click end def and_the_reference_request_status_is(status) - expect(reference_request_task_item.status_tag.text).to eq(status) + expect( + assessor_reference_requests_page.task_list.items.first.status_tag.text, + ).to eq(status) end def when_i_click_on_the_reference_request - reference_request_task_item.click + assessor_reference_requests_page.task_list.items.first.click end def and_i_see_the_reference_summary @@ -203,14 +205,7 @@ def and_i_submit_an_internal_note def then_i_see_the_reference_request_status_is_accepted expect( - assessor_reference_requests_page - .task_list - .sections - .first - .items - .first - .status_tag - .text, + assessor_reference_requests_page.task_list.items.first.status_tag.text, ).to eq("Completed") end @@ -220,21 +215,10 @@ def when_i_verify_that_all_references_are_accepted def then_i_see_the_verify_references_task_is_completed expect( - assessor_reference_requests_page - .task_list - .sections - .first - .items - .first - .status_tag - .text, + assessor_application_page.verify_references_task.status_tag.text, ).to eq("Completed") end - def reference_request_task_item - assessor_reference_requests_page.task_list.sections.first.items.first - end - def application_form @application_form ||= begin diff --git a/spec/system/assessor_interface/view_application_form_spec.rb b/spec/system/assessor_interface/view_application_form_spec.rb index 68018628a7..f077ed4ede 100644 --- a/spec/system/assessor_interface/view_application_form_spec.rb +++ b/spec/system/assessor_interface/view_application_form_spec.rb @@ -31,11 +31,11 @@ def then_i_see_the_application end def and_i_see_the_assessment_tasks - expect(assessor_application_page.task_list.sections.count).to eq(1) + expect(assessor_application_page.task_lists.count).to eq(1) section_links = - assessor_application_page.task_list.sections.first.items.map do |item| - item.name.text + assessor_application_page.task_lists.first.items.map do |item| + item.name_and_hint.text end expect(section_links).to eq( diff --git a/spec/system/assessor_interface/withdraw_application_spec.rb b/spec/system/assessor_interface/withdraw_application_spec.rb index ffd3d1822c..81445af236 100644 --- a/spec/system/assessor_interface/withdraw_application_spec.rb +++ b/spec/system/assessor_interface/withdraw_application_spec.rb @@ -39,11 +39,13 @@ def given_there_is_an_application_form end def and_i_see_the_withdraw_link - expect(assessor_application_page.task_list).to have_content("Withdraw") + expect(assessor_application_page.task_lists.last).to have_content( + "Withdraw", + ) end def when_i_click_on_withdraw - assessor_application_page.task_list.click_on("Withdraw") + assessor_application_page.task_lists.last.click_on("Withdraw") end def when_i_confirm_the_withdrawal diff --git a/spec/system/teacher_interface/further_information_spec.rb b/spec/system/teacher_interface/further_information_spec.rb index ebec37c7b2..cd8cc38ebd 100644 --- a/spec/system/teacher_interface/further_information_spec.rb +++ b/spec/system/teacher_interface/further_information_spec.rb @@ -101,15 +101,15 @@ def and_i_see_the_completed_work_history_contact_list_item end def when_i_click_the_text_task_list_item - text_task_list_item.link.click + text_task_list_item.click end def when_i_click_the_work_history_contact_task_list_item - work_history_task_list_item.link.click + work_history_task_list_item.click end def when_i_click_the_document_task_list_item - document_task_list_item.link.click + document_task_list_item.click end def when_i_fill_in_the_response diff --git a/spec/system/teacher_interface/qualification_consent_spec.rb b/spec/system/teacher_interface/qualification_consent_spec.rb index f1e106f43b..a6f87cf8a0 100644 --- a/spec/system/teacher_interface/qualification_consent_spec.rb +++ b/spec/system/teacher_interface/qualification_consent_spec.rb @@ -86,21 +86,15 @@ def and_i_see_qualification_consent_sign_out_content end def and_i_see_the_download_and_upload_tasks - task_list = teacher_qualification_requests_page.task_list - expect(task_list.sections.count).to eq(1) + task_lists = teacher_qualification_requests_page.task_lists + expect(task_lists.count).to eq(1) - task_list_section = task_list.sections.first - expect(task_list_section.items.count).to eq(2) + task_list = task_lists.first + expect(task_list.items.count).to eq(2) end def when_i_click_the_download_task - teacher_qualification_requests_page - .task_list - .sections - .first - .items - .first - .click + teacher_qualification_requests_page.task_lists.first.items.first.click end def when_i_check_the_downloaded_checkbox @@ -109,13 +103,7 @@ def when_i_check_the_downloaded_checkbox end def when_i_click_the_upload_task - teacher_qualification_requests_page - .task_list - .sections - .first - .items - .second - .click + teacher_qualification_requests_page.task_lists.first.items.second.click end def when_i_upload_a_file diff --git a/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb b/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb index 9abb7322ff..bce261cf73 100644 --- a/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb +++ b/spec/view_objects/teacher_interface/further_information_request_view_object_spec.rb @@ -26,8 +26,8 @@ } end - describe "#task_list_sections" do - subject(:task_list_sections) { view_object.task_list_sections } + describe "#task_list_items" do + subject(:task_list_items) { view_object.task_list_items } let!(:text_item) do create( @@ -46,32 +46,34 @@ end it do - is_expected.to include_task_list_item( - "Further information requested", - "Tell us more about the subjects you can teach", - link: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - text_item, - ], - status: :not_started, + is_expected.to include( + { + title: "Tell us more about the subjects you can teach", + href: [ + :edit, + :teacher_interface, + :application_form, + further_information_request, + text_item, + ], + status: :not_started, + }, ) end it do - is_expected.to include_task_list_item( - "Further information requested", - "Upload your identity document", - link: [ - :edit, - :teacher_interface, - :application_form, - further_information_request, - document_item, - ], - status: :not_started, + is_expected.to include( + { + title: "Upload your identity document", + href: [ + :edit, + :teacher_interface, + :application_form, + further_information_request, + document_item, + ], + status: :not_started, + }, ) end end