Skip to content

Commit

Permalink
Merge pull request #9984 from alphagov/content-modelling/937-remove-e…
Browse files Browse the repository at this point in the history
…mbed-code-for-pension-object

(937) Remove object-level embed codes
  • Loading branch information
pezholio authored Feb 26, 2025
2 parents 292c1e7 + 5f34ed3 commit 7671578
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def rows
organisation_item,
status_item,
(instructions_item if content_block_document.latest_edition.instructions_to_publishers.present?),
embed_code_item,
].compact
end

Expand Down Expand Up @@ -67,17 +66,6 @@ def instructions_item
}
end

def embed_code_item
{
key: "Embed code",
value: content_block_document.embed_code,
data: {
module: "copy-embed-code",
"embed-code": content_block_document.embed_code,
},
}
end

def title
content_block_document.title
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,13 @@ def rows
organisation_item,
instructions_item,
status_item,
embed_code_item,
].compact
end

def title
"#{content_block_document.block_type.humanize} details"
end

def embed_code_item
{
key: "Embed code",
value: content_block_document.embed_code,
data: {
module: "copy-embed-code",
"embed-code": content_block_document.embed_code,
},
}
end

def title_item
{
key: "Title",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@ Feature: Search for a content object
And I click to view results
Then I should see a message that the filter dates are invalid

@javascript
Scenario: GDS Editor can copy embed code
When I visit the Content Block Manager home page
And I select the lead organisation "Ministry of Example"
And I click to view results
And I click to copy the embed code for the content block "ministry address"
Then the embed code should be copied to my clipboard

Scenario: GDS Editor can view more than one page
When 1 content blocks of type email_address have been created with the fields:
| title | page 2 edition |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
When("I click to copy the embed code") do
find("a", text: "Copy code").click
has_text?("Code copied")
@embed_code = @content_block.document.embed_code
end

When("I click to copy the embed code for the content block {string}") do |content_block_name|
within(".govuk-summary-card", text: content_block_name) do
find("a", text: "Copy code").click
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ Feature: View a content object
Then I should see the dependent content listed
And I should see the rollup data for the dependent content

@javascript
Scenario: GDS Editor can copy embed code for whole block
When I visit the Content Block Manager home page
Then I should see the details for all documents
When I click to view the document
And I click to copy the embed code
Then the embed code should be copied to my clipboard

@javascript
Scenario: GDS Editor can copy embed code for a specific field
When I visit the Content Block Manager home page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ContentBlockManager::ContentBlock::Document::Index::SummaryCardComponentTe

assert_selector ".govuk-link", text: "View"

assert_selector ".govuk-summary-list__row", count: 6
assert_selector ".govuk-summary-list__row", count: 5

assert_selector ".govuk-summary-list__key", text: "Title"
assert_selector ".govuk-summary-list__value", text: content_block_edition.title
Expand All @@ -49,11 +49,6 @@ class ContentBlockManager::ContentBlock::Document::Index::SummaryCardComponentTe

assert_selector ".govuk-summary-list__key", text: "Status"
assert_selector ".govuk-summary-list__value", text: "Published 1 day ago by #{content_block_edition.creator.name}"

assert_selector ".govuk-summary-list__row[data-module='copy-embed-code']", text: "Embed code"
assert_selector ".govuk-summary-list__row[data-embed-code='#{content_block_document.embed_code}']", text: "Embed code"
assert_selector ".govuk-summary-list__key", text: "Embed code"
assert_selector ".govuk-summary-list__value", text: content_block_document.embed_code
end

describe "when there are instructions to publishers" do
Expand All @@ -62,7 +57,7 @@ class ContentBlockManager::ContentBlock::Document::Index::SummaryCardComponentTe

render_inline(ContentBlockManager::ContentBlock::Document::Index::SummaryCardComponent.new(content_block_document:))

assert_selector ".govuk-summary-list__row", count: 7
assert_selector ".govuk-summary-list__row", count: 6

assert_selector ".govuk-summary-list__key", text: "Instructions to publishers"
assert_selector ".govuk-summary-list__value", text: "instructions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ContentBlockManager::ContentBlock::Document::Show::SummaryCardComponentTes
it "renders a published content block correctly" do
render_inline(ContentBlockManager::ContentBlock::Document::Show::SummaryCardComponent.new(content_block_document:))

assert_selector ".govuk-summary-list__row", count: 7
assert_selector ".govuk-summary-list__row", count: 6

assert_selector ".govuk-summary-card__title", text: "Email address details"

Expand All @@ -43,19 +43,14 @@ class ContentBlockManager::ContentBlock::Document::Show::SummaryCardComponentTes

assert_selector ".govuk-summary-list__key", text: "Instructions to publishers"
assert_selector ".govuk-summary-list__value", text: "None"

assert_selector ".govuk-summary-list__row[data-module='copy-embed-code']", text: "Embed code"
assert_selector ".govuk-summary-list__row[data-embed-code='#{content_block_document.embed_code}']", text: "Embed code"
assert_selector ".govuk-summary-list__key", text: "Embed code"
assert_selector ".govuk-summary-list__value", text: content_block_document.embed_code
end

it "renders a scheduled content block correctly" do
content_block_document.latest_edition.state = "scheduled"

render_inline(ContentBlockManager::ContentBlock::Document::Show::SummaryCardComponent.new(content_block_document:))

assert_selector ".govuk-summary-list__row", count: 7
assert_selector ".govuk-summary-list__row", count: 6

assert_selector ".govuk-summary-list__key", text: "Status"
assert_selector ".govuk-summary-list__value", text: "Scheduled for publication at #{I18n.l(content_block_edition.scheduled_publication, format: :long_ordinal)}"
Expand Down

0 comments on commit 7671578

Please sign in to comment.