diff --git a/CHANGELOG.md b/CHANGELOG.md index fc2f7ecb26..e410ceab43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ## Unreleased +* Fix rendering of unnumbered papers ([PR #3988](https://github.com/alphagov/govuk_publishing_components/pull/3988)) * Add PDF specific icon to attachment component ([PR #3985](https://github.com/alphagov/govuk_publishing_components/pull/3985)) * Add the hidden attribute to mobile menu button ([PR #3975](https://github.com/alphagov/govuk_publishing_components/pull/3975)) * Add tool_name to GA4 feedback component tracking ([PR #3984](https://github.com/alphagov/govuk_publishing_components/pull/3984)) diff --git a/lib/govuk_publishing_components/presenters/attachment_helper.rb b/lib/govuk_publishing_components/presenters/attachment_helper.rb index 417c5f424a..0670a117b4 100644 --- a/lib/govuk_publishing_components/presenters/attachment_helper.rb +++ b/lib/govuk_publishing_components/presenters/attachment_helper.rb @@ -78,8 +78,8 @@ def reference end def unnumbered_reference - unnumbered_reference = "Unnumbered command paper" if attachment_data[:unnumbered_command_paper].eql?(true) && !attachment_data[:command_paper_number] - unnumbered_reference = "Unnumbered act paper" if attachment_data[:unnumbered_hoc_paper].eql?(true) && !attachment_data[:hoc_paper_number] + unnumbered_reference = "Unnumbered command paper" if attachment_data[:unnumbered_command_paper].eql?(true) && attachment_data[:command_paper_number].blank? + unnumbered_reference = "Unnumbered act paper" if attachment_data[:unnumbered_hoc_paper].eql?(true) && attachment_data[:hoc_paper_number].blank? unnumbered_reference end diff --git a/spec/lib/govuk_publishing_components/presenters/attachment_spec.rb b/spec/lib/govuk_publishing_components/presenters/attachment_spec.rb index 8732a3cc17..cfdf4c012b 100644 --- a/spec/lib/govuk_publishing_components/presenters/attachment_spec.rb +++ b/spec/lib/govuk_publishing_components/presenters/attachment_spec.rb @@ -175,6 +175,7 @@ title: "test", url: "test", content_type: "text/csv", + command_paper_number: "", unnumbered_command_paper: true, ) expect(attachment.unnumbered_reference).to eq("Unnumbered command paper") @@ -185,6 +186,7 @@ title: "test", url: "test", content_type: "text/csv", + hoc_paper_number: "", unnumbered_hoc_paper: true, ) expect(attachment.unnumbered_reference).to eq("Unnumbered act paper")