Skip to content

Commit

Permalink
Merge pull request #9695 from alphagov/content-modelling/719-review-page
Browse files Browse the repository at this point in the history
Content modelling/719 review page
  • Loading branch information
Harriethw authored Dec 4, 2024
2 parents 14edf18 + 5a34340 commit c728b04
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 33 deletions.
4 changes: 4 additions & 0 deletions features/step_definitions/previously_published_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
click_button "Save"
end

And(/^I click confirm$/) do
click_button "Confirm"
end

And(/^I select a previously published date in the future$/) do
check "This document has previously been published on another website"
within "#edition_previously_published" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ def initialize(content_block_edition:)
def items
[
edit_item,
title_item,
*details_items,
organisation_item,
instructions_item,
confirm_item,
date_item,
]
end

Expand All @@ -25,6 +24,13 @@ def edit_item
}
end

def title_item
{
field: "Title",
value: content_block_edition.title,
}
end

def details_items
content_block_edition.details.map do |key, value|
{
Expand All @@ -48,20 +54,6 @@ def instructions_item
}
end

def confirm_item
{
field: "Confirm",
value: "I confirm that I am happy for the content block to be changed on these pages.",
}
end

def date_item
{
field: "Publish date",
value: I18n.l(content_block_edition.created_at.to_date, format: :long_ordinal),
}
end

def edit_action
{
href: helpers.content_block_manager.content_block_manager_content_block_workflow_path(id: content_block_edition.id, step: ContentBlockManager::ContentBlock::Editions::WorkflowController::NEW_BLOCK_STEPS[:edit_draft]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :context, "Manage #{add_indefinite_article @content_block_edition.block_type.humanize.downcase}" %>
<% content_for :title, "Check your answers" %>
<% content_for :context, "Create a content block" %>
<% content_for :title, "Review #{@content_block_edition.block_type.humanize.downcase}" %>
<% content_for :back_link do %>
<%= render "govuk_publishing_components/components/back_link", {
href: content_block_manager.content_block_manager_content_block_documents_path,
Expand All @@ -22,9 +22,9 @@
<div class="govuk-button-group govuk-!-margin-bottom-6">
<div>
<%= render "govuk_publishing_components/components/button", {
text: "Accept and publish",
name: "accept_and_publish",
value: "Accept and publish",
text: "Confirm",
name: "confirm",
value: "Confirm",
type: "submit",
} %>
<% end %>
Expand Down
12 changes: 6 additions & 6 deletions lib/engines/content_block_manager/features/create_object.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Feature: Create a content object
When I complete the form with the following fields:
| title | email_address | department | organisation | instructions_to_publishers |
| my email address | foo@example.com | Somewhere | Ministry of Example | this is important |
Then I am asked to check my answers
When I accept and publish
Then I am asked to review my answers
When I click confirm
Then the edition should have been created successfully
And I should be taken to the confirmation page

Expand Down Expand Up @@ -59,7 +59,7 @@ Feature: Create a content object
When I complete the form with the following fields:
| title | email_address | department | organisation |
| my email address | foo@example.com | Somewhere | Ministry of Example |
Then I am asked to check my answers
Then I am asked to review my answers

Scenario: GDS editor cancels the creation of an object
When I visit the Content Block Manager home page
Expand All @@ -80,13 +80,13 @@ Feature: Create a content object
When I complete the form with the following fields:
| title | email_address | department | organisation |
| my email address | foo@example.com | Somewhere | Ministry of Example |
Then I am asked to check my answers
Then I am asked to review my answers
When I click the first edit link
And I complete the form with the following fields:
| title |
| my email address 2 |
Then I am asked to check my answers
When I accept and publish
Then I am asked to review my answers
When I click confirm
Then the edition should have been created successfully
And I should be taken to the confirmation page

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ def should_show_edit_form_for_email_address_content_block(document_title, email_
expect(page).to have_selector(".timeline__byline", text: "by #{@user.name}")
end

Then("I am asked to check my answers") do
assert_text "Check your answers"
Then("I am asked to review my answers") do
assert_text "Review email address"
end

Then("I accept and publish") do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ class ContentBlockManager::ContentBlockEdition::Show::ConfirmSummaryListComponen
test "renders a summary list component with the edition details to confirm" do
organisation = create(:organisation, name: "Department for Example")

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

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(
Expand All @@ -32,15 +35,13 @@ class ContentBlockManager::ContentBlockEdition::Show::ConfirmSummaryListComponen

assert_selector ".govuk-summary-list__key", text: "Email address details"
assert_selector ".govuk-summary-list__actions", text: "Edit"
assert_selector ".govuk-summary-list__key", text: "Title"
assert_selector ".govuk-summary-list__value", text: "Some title"
assert_selector ".govuk-summary-list__key", text: "New interesting fact"
assert_selector ".govuk-summary-list__value", text: "value of fact"
assert_selector ".govuk-summary-list__key", text: "Lead organisation"
assert_selector ".govuk-summary-list__value", text: "Department for Example"
assert_selector ".govuk-summary-list__key", text: "Instructions to publishers"
assert_selector ".govuk-summary-list__value", text: "None"
assert_selector ".govuk-summary-list__key", text: "Confirm"
assert_selector ".govuk-summary-list__value", text: "I confirm that I am happy for the content block to be changed on these pages."
assert_selector ".govuk-summary-list__key", text: "Publish date"
assert_selector ".govuk-summary-list__value", text: I18n.l(content_block_edition.created_at.to_date, format: :long_ordinal)
end
end

0 comments on commit c728b04

Please sign in to comment.