From 966d7ff02add63c2f505a90e4a96af6f2336ab10 Mon Sep 17 00:00:00 2001 From: Farhanam76 Date: Tue, 13 Feb 2024 08:19:14 +0000 Subject: [PATCH 1/8] Changed the section 1 Legal basis description and update the new changes for the preview questions --- .../Preview/IntroductionPreview/index.js | 18 +++++++++--------- eq-author/src/constants/legal-basis-options.js | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js index c67e455617..17dd724911 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js @@ -155,21 +155,21 @@ const IntroductionPreview = ({ introduction }) => { data-test="description" dangerouslySetInnerHTML={{ __html: description }} /> - {legalBasisCode !== "VOLUNTARY" && ( - <> - - {legalBasisDescription} - - )} {previewQuestions && ( <> - - You can preview the questions you - may be asked in this survey. + + View the questions you will be asked in this survey + )} + {legalBasisCode !== "VOLUNTARY" && ( + <> + + {legalBasisDescription} + + )} diff --git a/eq-author/src/constants/legal-basis-options.js b/eq-author/src/constants/legal-basis-options.js index 05117586ff..64bf5f4594 100644 --- a/eq-author/src/constants/legal-basis-options.js +++ b/eq-author/src/constants/legal-basis-options.js @@ -1,7 +1,8 @@ const LEGAL_BASIS_OPTIONS = [ { value: "NOTICE_1", - description: "Section 1 of the Statistics of Trade Act 1947.", + description: + "Notice is given under section 1 of the Statistics of Trade Act 1947.", }, { value: "NOTICE_2", From d7523fbeef0087461f2c91d3354df60efa47d735 Mon Sep 17 00:00:00 2001 From: Farhanam76 Date: Tue, 13 Feb 2024 13:08:07 +0000 Subject: [PATCH 2/8] Changed the notice description and added text for the description preview --- .../introduction/Preview/IntroductionPreview/index.js | 9 ++++++++- eq-author/src/constants/legal-basis-options.js | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js index 17dd724911..97e34f229b 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js @@ -167,7 +167,14 @@ const IntroductionPreview = ({ introduction }) => { {legalBasisCode !== "VOLUNTARY" && ( <> - {legalBasisDescription} + + {`Notice is given under + ${legalBasisCode === "NOTICE_FUELS" ? "the" : ""} + ${ + legalBasisDescription.charAt(0).toLowerCase() + + legalBasisDescription.slice(1) + }`} + )} diff --git a/eq-author/src/constants/legal-basis-options.js b/eq-author/src/constants/legal-basis-options.js index 64bf5f4594..05117586ff 100644 --- a/eq-author/src/constants/legal-basis-options.js +++ b/eq-author/src/constants/legal-basis-options.js @@ -1,8 +1,7 @@ const LEGAL_BASIS_OPTIONS = [ { value: "NOTICE_1", - description: - "Notice is given under section 1 of the Statistics of Trade Act 1947.", + description: "Section 1 of the Statistics of Trade Act 1947.", }, { value: "NOTICE_2", From 05de19368537cdc1a1132d74981fd67258cdc9f9 Mon Sep 17 00:00:00 2001 From: Farhanam76 Date: Tue, 13 Feb 2024 14:07:05 +0000 Subject: [PATCH 3/8] updated the snapshot and the test --- .../__snapshots__/index.test.js.snap | 4 +++- .../Preview/IntroductionPreview/index.js | 12 ++++++------ .../Preview/IntroductionPreview/index.test.js | 10 ++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap b/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap index 80ceba4945..d276b095d4 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap @@ -30,7 +30,9 @@ exports[`Introduction Preview should render 1`] = ` - + + Notice is given under section 1 of the Statistics of Trade Act 1947. + Start survey diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js index 97e34f229b..0821b384bd 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js @@ -168,12 +168,12 @@ const IntroductionPreview = ({ introduction }) => { <> - {`Notice is given under - ${legalBasisCode === "NOTICE_FUELS" ? "the" : ""} - ${ - legalBasisDescription.charAt(0).toLowerCase() + - legalBasisDescription.slice(1) - }`} + {`Notice is given under ${ + legalBasisCode === "NOTICE_FUELS" + ? `the ${legalBasisDescription}` + : legalBasisDescription?.charAt(0).toLowerCase() + + legalBasisDescription?.slice(1) + }`} )} diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.test.js b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.test.js index e4716d82e1..5034558d75 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.test.js +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.test.js @@ -4,6 +4,11 @@ import { shallow } from "enzyme"; import { useQuery } from "@apollo/react-hooks"; import IntroductionPreview, { Collapsibles } from "."; +import { useQuestionnaire } from "components/QuestionnaireContext"; + +jest.mock("components/QuestionnaireContext", () => ({ + useQuestionnaire: jest.fn(), +})); jest.mock("@apollo/react-hooks", () => ({ ...jest.requireActual("@apollo/react-hooks"), @@ -18,6 +23,11 @@ useQuery.mockImplementation(() => ({ describe("Introduction Preview", () => { let props; + useQuestionnaire.mockImplementation(() => ({ + questionnaire: { + legalBasis: "NOTICE_1", + }, + })); beforeEach(() => { props = { loading: false, From 3af310065c2d01a2c127d25e0c9aef38313b926b Mon Sep 17 00:00:00 2001 From: Farhanam76 Date: Thu, 15 Feb 2024 14:26:52 +0000 Subject: [PATCH 4/8] Removed charAT from the legal basis --- .../src/App/introduction/Preview/IntroductionPreview/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js index 0821b384bd..e2ecfd8a51 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js @@ -171,8 +171,7 @@ const IntroductionPreview = ({ introduction }) => { {`Notice is given under ${ legalBasisCode === "NOTICE_FUELS" ? `the ${legalBasisDescription}` - : legalBasisDescription?.charAt(0).toLowerCase() + - legalBasisDescription?.slice(1) + : legalBasisDescription }`} From d7612a1da56a05df89aea438cf9808617c2fe965 Mon Sep 17 00:00:00 2001 From: Farhanam76 Date: Fri, 16 Feb 2024 11:06:33 +0000 Subject: [PATCH 5/8] added test to check if the word 'the' is added for NOTICE_FUELS --- .../Preview/IntroductionPreview/index.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.test.js b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.test.js index 5034558d75..d53dd29259 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.test.js +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.test.js @@ -57,6 +57,16 @@ describe("Introduction Preview", () => { expect(shallow()).toMatchSnapshot(); }); + it("should render the word 'the' when legal basis is NOTICE_FUELS", () => { + useQuestionnaire.mockImplementation(() => ({ + questionnaire: { + legalBasis: "NOTICE_FUELS", + }, + })); + + expect(shallow()).toMatchSnapshot(); + }); + it("should not show incomplete collapsibles", () => { props.introduction.collapsibles = [ { id: "2", title: "collapsible title", description: "" }, From 4429604bf8d351fde4ee39cb4b823d327a7f753b Mon Sep 17 00:00:00 2001 From: Farhanam76 Date: Mon, 19 Feb 2024 10:57:53 +0000 Subject: [PATCH 6/8] Changed the legal basis first letter of section to lowercase --- .../__snapshots__/index.test.js.snap | 61 +++++++++++++++++++ .../Preview/IntroductionPreview/index.js | 4 +- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap b/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap index d276b095d4..4478d4acbf 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap @@ -60,3 +60,64 @@ exports[`Introduction Preview should render 1`] = ` /> `; + +exports[`Introduction Preview should render the word 'the' when legal basis is NOTICE_FUELS 1`] = ` + + + If the company details or structure have changed contact us on + + + 0300 1234 931 + + + or email + + + surveys@ons.gov.uk + + bar

", + } + } + data-test="description" + /> + + + Notice is given under the Petroleum Act 1998 and Section 1 of the Statistics of Trade Act 1947. + + + Start survey + + + secondaryDescription

", + } + } + /> + + +
+`; diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js index e2ecfd8a51..a12515b0d5 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js @@ -171,7 +171,9 @@ const IntroductionPreview = ({ introduction }) => { {`Notice is given under ${ legalBasisCode === "NOTICE_FUELS" ? `the ${legalBasisDescription}` - : legalBasisDescription + : `${legalBasisDescription + ?.charAt(0) + .toLowerCase()}${legalBasisDescription?.slice(1)}` }`} From d71a4baee6f32afaa72ae3193d786b61bc52b3e4 Mon Sep 17 00:00:00 2001 From: Farhanam76 Date: Tue, 20 Feb 2024 15:17:04 +0000 Subject: [PATCH 7/8] Renamed BlueUnderLined tag to DummyLink --- .../introduction/Preview/IntroductionPreview/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js index a12515b0d5..ca5d3e124e 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/index.js @@ -94,7 +94,7 @@ const CollapsiblesContent = styled.div` padding: 0.2em 0 0.2em 1em; `; -const BlueUnderlined = styled.text` +const DummyLink = styled.text` color: ${colors.blue}; text-decoration: underline; `; @@ -135,13 +135,13 @@ const IntroductionPreview = ({ introduction }) => { If the company details or structure have changed contact us on{" "} {contactDetailsPhoneNumber !== "" ? ( - {contactDetailsPhoneNumber} + {contactDetailsPhoneNumber} ) : ( Phone number missing )}{" "} or email{" "} {contactDetailsEmailAddress !== "" ? ( - {contactDetailsEmailAddress} + {contactDetailsEmailAddress} ) : ( Email address missing )} @@ -158,9 +158,9 @@ const IntroductionPreview = ({ introduction }) => { {previewQuestions && ( <> - + View the questions you will be asked in this survey - + )} From 518e8e4e9a7d38950602afbbce299155b851f3a2 Mon Sep 17 00:00:00 2001 From: Farhanam76 Date: Tue, 20 Feb 2024 16:30:42 +0000 Subject: [PATCH 8/8] Updated the snapshots for the test of introduction page preview --- .../__snapshots__/index.test.js.snap | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap b/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap index 4478d4acbf..4ae258fd49 100644 --- a/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap +++ b/eq-author/src/App/introduction/Preview/IntroductionPreview/__snapshots__/index.test.js.snap @@ -10,15 +10,15 @@ exports[`Introduction Preview should render 1`] = ` /> If the company details or structure have changed contact us on - + 0300 1234 931 - + or email - + surveys@ons.gov.uk - + If the company details or structure have changed contact us on - + 0300 1234 931 - + or email - + surveys@ons.gov.uk - +