Skip to content

Commit

Permalink
add publish date for updated blocks on review page
Browse files Browse the repository at this point in the history
  • Loading branch information
Harriethw committed Dec 11, 2024
1 parent b76c1d6 commit fd09930
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ def status_item
field: "Scheduled date and time",
value: scheduled_value,
}
elsif content_block_edition.document.editions.count > 1
{
field: "Publish date",
value: I18n.l(Time.zone.today, format: :long_ordinal),
}
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,34 @@ class ContentBlockManager::ContentBlockEdition::Show::ConfirmSummaryListComponen
assert_selector ".govuk-summary-list__value", text: I18n.l(content_block_edition.scheduled_publication, format: :long_ordinal)
end
end

describe "when the content block is being updated and published immediately" do
it "shows a publish now row" do
organisation = create(:organisation, name: "Department for Example")

content_block_document = create(:content_block_document, :email_address, title: "Some title")

_previous_edition = create(
:content_block_edition,
:email_address,
organisation:,
document: content_block_document,
)

content_block_edition = create(
:content_block_edition,
:email_address,
details: { "interesting_fact" => "value of fact" },
organisation:,
document: content_block_document,
)

render_inline(ContentBlockManager::ContentBlockEdition::Show::ConfirmSummaryListComponent.new(
content_block_edition:,
))

assert_selector ".govuk-summary-list__key", text: "Publish date"
assert_selector ".govuk-summary-list__value", text: I18n.l(Time.zone.today, format: :long_ordinal)
end
end
end

0 comments on commit fd09930

Please sign in to comment.