From de93ba5dbd3d5a72ee92fcc426763f490338c146 Mon Sep 17 00:00:00 2001 From: pezholio Date: Thu, 21 Nov 2024 14:29:09 +0000 Subject: [PATCH] Fix Homepage layout When the Javascript added the Copy code link, the `govuk-summary-list__row--no-actions` class remained in place, which left an unsightly gap on the right hand side. This updates the JS to remove the class once we have appended the action element, meaning the gap is no longer there --- .../content_block_manager/modules/copy-embed-code.js | 1 + .../spec/content_block_manager/copy-code.spec.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/engines/content_block_manager/app/assets/javascripts/content_block_manager/modules/copy-embed-code.js b/lib/engines/content_block_manager/app/assets/javascripts/content_block_manager/modules/copy-embed-code.js index bcd9bde1d26..d974c7b7844 100644 --- a/lib/engines/content_block_manager/app/assets/javascripts/content_block_manager/modules/copy-embed-code.js +++ b/lib/engines/content_block_manager/app/assets/javascripts/content_block_manager/modules/copy-embed-code.js @@ -13,6 +13,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {} dd.append(this.copyLink) this.module.append(dd) + this.module.classList.remove('govuk-summary-list__row--no-actions') } CopyEmbedCode.prototype.createLink = function () { diff --git a/lib/engines/content_block_manager/spec/content_block_manager/copy-code.spec.js b/lib/engines/content_block_manager/spec/content_block_manager/copy-code.spec.js index a09c27a8df9..eed626f28f9 100644 --- a/lib/engines/content_block_manager/spec/content_block_manager/copy-code.spec.js +++ b/lib/engines/content_block_manager/spec/content_block_manager/copy-code.spec.js @@ -29,6 +29,12 @@ describe('GOVUK.Modules.CopyEmbedCode', function () { expect(copyLink.textContent).toBe('Copy code') }) + it('should remove the .govuk-summary-list__row--no-actions class', function () { + expect(fixture.classList).not.toContain( + 'govuk-summary-list__row--no-actions' + ) + }) + it('should create and populate a textarea', function () { window.GOVUK.triggerEvent(copyLink, 'click')