Skip to content

Commit

Permalink
Merge pull request #4217 from DFE-Digital/1673-hide-course-length-row…
Browse files Browse the repository at this point in the history
…-for-tda-courses

[1673] Hide course length change link for TDA courses
  • Loading branch information
avinhurry authored May 21, 2024
2 parents a36d780 + 46d021c commit edfda9b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/decorators/course_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/views/publish/courses/_description_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
) %>

Expand Down Expand Up @@ -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"
) %>

Expand Down
20 changes: 18 additions & 2 deletions spec/features/publish/courses/new_tda_course_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions spec/support/page_objects/publish/provider_courses_show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"]'
Expand Down

0 comments on commit edfda9b

Please sign in to comment.