diff --git a/app/decorators/course_decorator.rb b/app/decorators/course_decorator.rb index 396be9b403..1f1c0f14fb 100644 --- a/app/decorators/course_decorator.rb +++ b/app/decorators/course_decorator.rb @@ -420,6 +420,10 @@ def cannot_change_study_mode? is_withdrawn? || teacher_degree_apprenticeship? end + def cannot_change_course_length? + teacher_degree_apprenticeship? || is_withdrawn? + end + def cannot_change_skilled_worker_visa? is_withdrawn? || teacher_degree_apprenticeship? end diff --git a/app/views/publish/courses/_description_content.html.erb b/app/views/publish/courses/_description_content.html.erb index 8edf1f01be..5bca40a534 100644 --- a/app/views/publish/courses/_description_content.html.erb +++ b/app/views/publish/courses/_description_content.html.erb @@ -47,7 +47,7 @@ "Course length", value_provided?(course.length), %w[course_length], - action_path: course.is_withdrawn? ? nil : "#{fees_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code)}#course-length", + action_path: course.cannot_change_course_length? ? nil : "#{fees_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code)}#course-length", action_visually_hidden_text: "course length" ) %> @@ -103,7 +103,7 @@ "Course length", value_provided?(course.length), %w[course_length], - action_path: course.is_withdrawn? ? nil : "#{salary_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code)}#course-length", + action_path: course.cannot_change_course_length? ? nil : "#{salary_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code)}#course-length", action_visually_hidden_text: "course length" ) %> diff --git a/spec/features/publish/courses/new_tda_course_spec.rb b/spec/features/publish/courses/new_tda_course_spec.rb index 0282de16e2..4e5010a858 100644 --- a/spec/features/publish/courses/new_tda_course_spec.rb +++ b/spec/features/publish/courses/new_tda_course_spec.rb @@ -38,8 +38,10 @@ when_i_click_on_the_course_i_created then_i_do_not_see_the_change_links_for_study_mode_funding_type_and_visa_sponsorship_on_basic_details + when_i_click_on_the_course_description_tab then_i_do_not_see_the_degree_requirements_row + and_i_do_not_see_the_change_link_for_course_length end scenario 'creating a degree awarding course from scitt provider' do @@ -72,8 +74,10 @@ when_i_click_on_the_course_i_created then_i_do_not_see_the_change_links_for_study_mode_funding_type_and_visa_sponsorship_on_basic_details + when_i_click_on_the_course_description_tab then_i_do_not_see_the_degree_requirements_row + and_i_do_not_see_the_change_link_for_course_length end scenario 'when choosing primary course' do @@ -105,8 +109,10 @@ when_i_click_on_the_course_i_created then_i_do_not_see_the_change_links_for_study_mode_funding_type_and_visa_sponsorship_on_basic_details + when_i_click_on_the_course_description_tab then_i_do_not_see_the_degree_requirements_row + and_i_do_not_see_the_change_link_for_course_length end scenario 'do not show teacher degree apprenticeship for further education' do @@ -339,15 +345,25 @@ def then_i_do_not_see_the_change_links_for_study_mode_funding_type_and_visa_spon end end + def and_i_do_not_see_the_change_link_for_course_length + within('[data-qa="enrichment__course_length"]') do + expect(page).to have_no_link('Change') + end + end + def when_i_click_on_the_course_i_created click_on course_name_and_code - when_i_click_on_the_course_description_tab + when_i_click_on_the_course_basic_details_tab end - def when_i_click_on_the_course_description_tab + def when_i_click_on_the_course_basic_details_tab publish_provider_courses_show_page.basic_details_link.click end + def when_i_click_on_the_course_description_tab + publish_provider_courses_show_page.description_link.click + end + def then_i_do_not_see_the_degree_requirements_row expect(publish_provider_courses_show_page).not_to have_degree end diff --git a/spec/support/page_objects/publish/provider_courses_show.rb b/spec/support/page_objects/publish/provider_courses_show.rb index 79cc782aa3..57eac3b596 100644 --- a/spec/support/page_objects/publish/provider_courses_show.rb +++ b/spec/support/page_objects/publish/provider_courses_show.rb @@ -27,6 +27,7 @@ class ProviderCoursesShow < PageObjects::Base section :other_requirements, Sections::SummaryList, '[data-qa="enrichment__other_requirements"]' section :course_button_panel, Sections::CourseButtonPanel, '[data-qa="course__button_panel"]' + element :description_link, 'a.govuk-link.govuk-tabs__tab', text: 'Description' element :basic_details_link, 'a.govuk-link.govuk-tabs__tab', text: 'Basic details' element :content_status, '[data-qa="course__content-status"]' element :rolled_over_course_link, '[data-qa="course__rolled-over-link"]'