Skip to content

Commit

Permalink
Merge pull request #1781 from alphagov/dependabot/bundler/govuk_publi…
Browse files Browse the repository at this point in the history
…shing_components-21.53.0

Bump govuk_publishing_components from 21.52.0 to 21.53.0
  • Loading branch information
andysellick authored May 29, 2020
2 parents 261e127 + a0812da commit 0018905
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem "dalli"
gem "gds-api-adapters", "~> 63.5"
gem "govuk_ab_testing", "~> 2.4"
gem "govuk_app_config", "~> 2.2"
gem "govuk_publishing_components", "~> 21.52.0"
gem "govuk_publishing_components", "~> 21.53.0"
gem "htmlentities", "~> 4.3"
gem "plek", "~> 3.0"
gem "rack_strip_client_ip", "~> 0.0.2"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ GEM
sentry-raven (>= 2.7.1, < 3.1.0)
statsd-ruby (~> 1.4.0)
unicorn (>= 5.4, < 5.6)
govuk_publishing_components (21.52.0)
govuk_publishing_components (21.53.0)
gds-api-adapters
govuk_app_config
kramdown
Expand Down Expand Up @@ -358,7 +358,7 @@ DEPENDENCIES
gds-api-adapters (~> 63.5)
govuk_ab_testing (~> 2.4)
govuk_app_config (~> 2.2)
govuk_publishing_components (~> 21.52.0)
govuk_publishing_components (~> 21.53.0)
govuk_schemas (~> 4.0)
govuk_test
htmlentities (~> 4.3)
Expand Down
20 changes: 11 additions & 9 deletions test/integration/html_publication_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
end

test "html publications" do
setup_and_visit_content_item("published")
setup_and_visit_html_publication("published")

within ".gem-c-inverse-header" do
assert page.has_text?(@content_item["details"]["format_sub_type"])
Expand All @@ -24,7 +24,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
end

test "html publications with meta data" do
setup_and_visit_content_item("print_with_meta_data")
setup_and_visit_html_publication("print_with_meta_data")

within ".govuk-grid-row.sidebar-with-body" do
assert page.find(".print-meta-data", visible: false)
Expand All @@ -35,7 +35,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
end

test "html publications with meta data - print version" do
setup_and_visit_content_item("print_with_meta_data", "?medium=print")
setup_and_visit_html_publication("print_with_meta_data", "?medium=print")

within ".govuk-grid-row.sidebar-with-body" do
assert page.find(".print-meta-data", visible: true)
Expand All @@ -46,25 +46,25 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
end

test "renders back to contents elements" do
setup_and_visit_content_item("published")
setup_and_visit_html_publication("published")
assert page.has_css?(".app-c-back-to-top[href='#contents']")
end

test "prime minister office organisation html publication" do
setup_and_visit_content_item("prime_ministers_office")
setup_and_visit_html_publication("prime_ministers_office")
assert_has_component_organisation_logo_with_brand("executive-office", 4)
end

test "no contents are shown when headings are an empty list" do
setup_and_visit_content_item("prime_ministers_office")
setup_and_visit_html_publication("prime_ministers_office")

within ".gem-c-inverse-header" do
assert_not page.has_text?("Contents")
end
end

test "html publication with rtl text direction" do
setup_and_visit_content_item("arabic_translation")
setup_and_visit_html_publication("arabic_translation")
assert page.has_css?("#wrapper.direction-rtl"), "has .direction-rtl class on #wrapper element"
end

Expand All @@ -81,6 +81,7 @@ def assert_has_component_organisation_logo_with_brand(brand, index = 1)
'withdrawn_at': "2014-08-09T11:39:05Z",
}

stub_content_store_has_item(content_item["links"]["parent"][0]["base_path"])
stub_content_store_has_item("/government/publications/canada-united-kingdom-joint-declaration/canada-united-kingdom-joint-declaration", content_item.to_json)
visit_with_cachebust "/government/publications/canada-united-kingdom-joint-declaration/canada-united-kingdom-joint-declaration"

Expand All @@ -90,12 +91,13 @@ def assert_has_component_organisation_logo_with_brand(brand, index = 1)

test "if document has no parent document_type 'publication' is shown" do
content_item = GovukSchemas::Example.find("html_publication", example_name: "prime_ministers_office")
content_item["links"]["parent"][0]["document_type"] = nil
parent = content_item["links"]["parent"][0]
parent["document_type"] = nil
content_item["withdrawn_notice"] = {
'explanation': "This is out of date",
'withdrawn_at': "2014-08-09T11:39:05Z",
}

stub_content_store_has_item(parent["base_path"])
stub_content_store_has_item("/government/publications/canada-united-kingdom-joint-declaration/canada-united-kingdom-joint-declaration", content_item.to_json)
visit_with_cachebust "/government/publications/canada-united-kingdom-joint-declaration/canada-united-kingdom-joint-declaration"

Expand Down
19 changes: 19 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ def setup_and_visit_content_item(name, parameter_string = "")
end
end

def setup_and_visit_html_publication(name, parameter_string = "")
@content_item = get_content_example(name).tap do |item|
parent = item["links"]["parent"][0]
stub_content_store_has_item(item["base_path"], item.to_json)
stub_content_store_has_item(parent["base_path"], parent.to_json)
visit_with_cachebust("#{item['base_path']}#{parameter_string}")
end
end

def setup_and_visit_content_item_with_taxons(name, taxons)
@content_item = get_content_example(name).tap do |item|
item["links"]["taxons"] = taxons
Expand All @@ -156,8 +165,18 @@ def setup_and_visit_random_content_item(document_type: nil)
content_id = content_item["content_id"]
path = content_item["base_path"]

if schema_type == "html_publication"
parent = content_item.dig("links", "parent")&.first
if parent
parent_path = parent["base_path"]
stub_request(:get, %r{#{parent_path}})
.to_return(status: 200, body: content_item.to_json, headers: {})
end
end

stub_request(:get, %r{#{path}})
.to_return(status: 200, body: content_item.to_json, headers: {})

visit path

assert_selector %(meta[name="govuk:content-id"][content="#{content_id}"]), visible: false
Expand Down

0 comments on commit 0018905

Please sign in to comment.