Skip to content

Commit

Permalink
Merge pull request #2393 from alphagov/incomplete-page-title-for-firs…
Browse files Browse the repository at this point in the history
…t-page-of-mainstream-guide

Fix incomplete page title for first page of mainstream guide
  • Loading branch information
maxgds authored Mar 16, 2022
2 parents 2320226 + e8b19dd commit 7ea43a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/presenters/guide_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class GuidePresenter < ContentItemPresenter
attr_accessor :draft_access_token

def page_title
if @part_slug
if parts.any?
"#{super}: #{current_part_title}"
else
super
Expand Down
3 changes: 1 addition & 2 deletions test/presenters/guide_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ def schema_name
end

test "presents unique page titles for each part" do
assert_equal presented_item.page_title, schema_item["title"]
schema_item["details"]["parts"].each do |part|
assert_equal presented_item("guide", part["slug"]).page_title, "#{schema_item['title']}: #{part['title']}"
end
end

test "presents withdrawn in the title for withdrawn content" do
presented_item = presented_item(schema_name, nil, "withdrawn_notice" => { "explanation": "Withdrawn", "withdrawn_at": "2014-08-22T10:29:02+01:00" })
assert_equal "[Withdrawn] The national curriculum", presented_item.page_title
assert_equal "[Withdrawn] The national curriculum: Overview", presented_item.page_title
end

test "presents a print link" do
Expand Down

0 comments on commit 7ea43a6

Please sign in to comment.