-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from companieshouse/lp-241-cya-page-template-…
…routing Lp 241 cya page template routing
- Loading branch information
Showing
11 changed files
with
239 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/presentation/test/integration/registration/check-your-answers.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import request from "supertest"; | ||
import app from "../app"; | ||
import { CHECK_YOUR_ANSWERS_URL } from "../../../controller/registration/url"; | ||
import { LocalesService } from "@companieshouse/ch-node-utils"; | ||
import * as config from "../../../../config/constants"; | ||
import enTranslationText from "../../../../../locales/en/translations.json"; | ||
import cyTranslationText from "../../../../../locales/cy/translations.json"; | ||
import { appDevDependencies } from "../../../../config/dev-dependencies"; | ||
import LimitedPartnershipBuilder from "../../builder/LimitedPartnershipBuilder"; | ||
|
||
describe("Check Your Answers Page", () => { | ||
const setLocalesEnabled = (bool: boolean) => { | ||
jest.spyOn(config, "isLocalesEnabled").mockReturnValue(bool); | ||
LocalesService.getInstance().enabled = bool; | ||
}; | ||
|
||
it("should GET Check Your Answers Page English text", async () => { | ||
setLocalesEnabled(true); | ||
const res = await request(app).get(CHECK_YOUR_ANSWERS_URL + "?lang=en"); | ||
|
||
expect(res.status).toBe(200); | ||
expect(res.text).toContain(enTranslationText.checkYourAnswersPage.title); | ||
expect(res.text).toContain(enTranslationText.checkYourAnswersPage.lpInfo); | ||
expect(res.text).toContain(enTranslationText.checkYourAnswersPage.headingName); | ||
expect(res.text).toContain(enTranslationText.checkYourAnswersPage.headingSic); | ||
expect(res.text).toContain(enTranslationText.checkYourAnswersPage.headingEmail); | ||
expect(res.text).toContain(enTranslationText.checkYourAnswersPage.headingTerm); | ||
expect(res.text).toContain(enTranslationText.checkYourAnswersPage.confirm); | ||
expect(res.text).toContain(enTranslationText.checkYourAnswersPage.futureLawful); | ||
expect(res.text).toContain(enTranslationText.checkYourAnswersPage.payment); | ||
expect(res.text).not.toContain("WELSH -"); | ||
}); | ||
|
||
it("should GET Check Your Answers Page Welsh text", async () => { | ||
setLocalesEnabled(true); | ||
const res = await request(app).get(CHECK_YOUR_ANSWERS_URL + "?lang=cy"); | ||
|
||
expect(res.status).toBe(200); | ||
expect(res.text).toContain(cyTranslationText.checkYourAnswersPage.title); | ||
expect(res.text).toContain(cyTranslationText.checkYourAnswersPage.lpInfo); | ||
expect(res.text).toContain(cyTranslationText.checkYourAnswersPage.headingName); | ||
expect(res.text).toContain(cyTranslationText.checkYourAnswersPage.headingSic); | ||
expect(res.text).toContain(cyTranslationText.checkYourAnswersPage.headingEmail); | ||
expect(res.text).toContain(cyTranslationText.checkYourAnswersPage.headingTerm); | ||
expect(res.text).toContain(cyTranslationText.checkYourAnswersPage.confirm); | ||
expect(res.text).toContain(cyTranslationText.checkYourAnswersPage.futureLawful); | ||
expect(res.text).toContain(cyTranslationText.checkYourAnswersPage.payment); | ||
expect(res.text).toContain("WELSH -"); | ||
}); | ||
|
||
it("should load the check your answers page with data from api", async () => { | ||
const limitedPartnership = new LimitedPartnershipBuilder().build(); | ||
appDevDependencies.limitedPartnershipGateway.feedLimitedPartnerships([ | ||
limitedPartnership | ||
]); | ||
const res = await request(app).get(CHECK_YOUR_ANSWERS_URL); | ||
|
||
expect(res.status).toBe(200); | ||
expect(res.text).toContain(limitedPartnership?.data?.partnership_name); | ||
expect(res.text).toContain(limitedPartnership?.data?.email); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{% extends "layout.njk" %} | ||
|
||
{% set pageTitle = title %} | ||
|
||
{% block content %} | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds-from-desktop"> | ||
<h1 class="govuk-heading-l">{{ i18n.checkYourAnswersPage.title }}</h1> | ||
<h2 class="govuk-heading-m">{{ i18n.checkYourAnswersPage.lpInfo }}</h2> | ||
{{ govukSummaryList({ | ||
classes: "govuk-!-margin-bottom-9", | ||
rows: [ | ||
{ | ||
key: { | ||
text: i18n.checkYourAnswersPage.headingName | ||
}, | ||
value: { | ||
text: props.data.limitedPartnership.data.partnership_name | ||
}, | ||
actions: { | ||
items: [ | ||
{ | ||
href: "javascript:void(0)", | ||
text: "Change", | ||
visuallyHiddenText: "Name" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
key: { | ||
text: i18n.checkYourAnswersPage.headingSic | ||
}, | ||
value: { | ||
text: "62012 - Business and domestic software development" | ||
}, | ||
actions: { | ||
items: [ | ||
{ | ||
href: "javascript:void(0)", | ||
text: "Change", | ||
visuallyHiddenText: "Standard Industrial Classification code" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
key: { | ||
text: i18n.checkYourAnswersPage.headingEmail | ||
}, | ||
value: { | ||
text: props.data.limitedPartnership.data.email | ||
}, | ||
actions: { | ||
items: [ | ||
{ | ||
href: "javascript:void(0)", | ||
text: "Change", | ||
visuallyHiddenText: "registered email address" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
key: { | ||
text: i18n.checkYourAnswersPage.headingTerm | ||
}, | ||
value: { | ||
text: data['term-of-partners'] or "Term will be decided by some or all of the partners" | ||
}, | ||
actions: { | ||
items: [ | ||
{ | ||
href: "javascript:void(0)", | ||
text: "Change", | ||
visuallyHiddenText: "term of partnership" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}) }} | ||
|
||
<br> | ||
<div class="govuk-button-group"> | ||
<form class="form" action={{ props.currentUrl }} method="post"> | ||
<input type="hidden" name="pageType" value={{ props.pageType }}> | ||
{% include "includes/csrf_token.njk" %} | ||
|
||
{{ govukCheckboxes({ | ||
name: "lpStatement", | ||
fieldset: { | ||
legend: { | ||
text: i18n.checkYourAnswersPage.confirm, | ||
isPageHeading: false, | ||
classes: "govuk-visually-hidden" | ||
} | ||
}, | ||
items: [ | ||
{ | ||
value: "lp-statement", | ||
text: i18n.checkYourAnswersPage.futureLawful, | ||
attributes: { | ||
required: true | ||
} | ||
} | ||
] | ||
}) }} | ||
|
||
{{ govukButton({ | ||
text: i18n.checkYourAnswersPage.payment, | ||
attributes: { | ||
"id": "submit", | ||
"data-event-id": "check-your-answers-continue-to-payment-page-button" | ||
} | ||
}) }} | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters