Skip to content

Commit

Permalink
Merge pull request #2890 from alphagov/fix-spacing-issue-on-roles-on-…
Browse files Browse the repository at this point in the history
…worldwide-organisation

Add spacing to WorldWideOrganisation descriptions
  • Loading branch information
patrickpatrickpatrick authored Aug 8, 2023
2 parents 8f37863 + 806863a commit dfad328
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/presenters/worldwide_organisation_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def person_in_primary_role
href: person["web_url"],
image_url: person["details"]["image"]["url"],
image_alt: person["details"]["image"]["alt_text"],
description: current_roles.map { |role_app| role_app.dig("links", "role").first["title"] }.join,
description: current_roles.map { |role_app| role_app.dig("links", "role").first["title"] }.join(", "),
}
end

Expand All @@ -67,7 +67,7 @@ def people_in_non_primary_roles
{
name: person["title"],
href: person["web_url"],
description: current_roles.map { |role_app| role_app.dig("links", "role").first["title"] }.join,
description: current_roles.map { |role_app| role_app.dig("links", "role").first["title"] }.join(", "),
}
end
end
Expand Down
10 changes: 10 additions & 0 deletions test/presenters/worldwide_organisation_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ def schema_name
"worldwide_organisation"
end

test "description of primary_role_person should have spaces between roles" do
presenter = create_presenter(WorldwideOrganisationPresenter, content_item: { "links" => { "primary_role_person" => [{ "details" => { "image" => {} }, "links" => { "role_appointments" => [{ "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 1" }] } }, { "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 2" }] } }] } }] } })
assert_equal "Example Role 1, Example Role 2", presenter.person_in_primary_role[:description]
end

test "description of people_in_non_primary_roles should have spaces between roles" do
presenter = create_presenter(WorldwideOrganisationPresenter, content_item: { "links" => { "secondary_role_person" => [{ "details" => { "image" => {} }, "links" => { "role_appointments" => [{ "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 1" }] } }, { "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 2" }] } }] } }] } })
assert_equal "Example Role 1, Example Role 2", presenter.people_in_non_primary_roles.first[:description]
end

test "#title returns the title" do
assert_equal schema_item["title"], presented_item.title
end
Expand Down

0 comments on commit dfad328

Please sign in to comment.