From e310ff34696d0f280bbfd45355eed50bc8650cff Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Fri, 11 Feb 2022 16:36:49 +0000 Subject: [PATCH] Quick fixes for updateContent tests To address issues in these comments: - https://github.com/alphagov/notifications-admin/pull/4155#discussion_r804641078 - https://github.com/alphagov/notifications-admin/pull/4155#discussion_r804642005 --- tests/javascripts/updateContent.test.js | 27 ++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/javascripts/updateContent.test.js b/tests/javascripts/updateContent.test.js index 6923105a9..d33c730b5 100644 --- a/tests/javascripts/updateContent.test.js +++ b/tests/javascripts/updateContent.test.js @@ -317,7 +317,7 @@ describe('Update content', () => { document.body.innerHTML = initialHTMLString; - // make the response have an extra item + // make a response with no changes responseObj[updateKey] = HTMLString; // start the module @@ -468,8 +468,29 @@ describe('Update content', () => { // Add class to indicate focus state of link on parent heading document.querySelectorAll('.file-list h2')[0].classList.add('js-child-has-focus'); - // make the response match the initial HTML to emulate a response with no changes - responseObj[updateKey] = HTMLString; + var updatedHTMLString = getHTMLString([ + { + title: "Gas leak", + hint: "There's a gas leak in the local area. Residents should vacate until further notice.", + status: "Waiting for approval", + areas: [ + "Santa Claus Village, Rovaniemi B", + "Santa Claus Village, Rovaniemi C" + ] + }, + { + title: "Reservoir flooding template", + hint: "The local reservoir has flooded. All people within 5 miles should move to a safer location.", + status: "Waiting for approval", + areas: [ + "Santa Claus Village, Rovaniemi A", + "Santa Claus Village, Rovaniemi D" + ] + } + ]); + + // make the response have an extra item + responseObj[updateKey] = updatedHTMLString; // start the module window.GOVUK.modules.start();