Skip to content

Commit

Permalink
feat(EMS-304): update tell us about your policy page - credit period …
Browse files Browse the repository at this point in the history
…hint text
  • Loading branch information
ttbarnes committed Sep 12, 2022
1 parent a47b682 commit 4b53c9c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
13 changes: 12 additions & 1 deletion e2e-tests/content-strings/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ const FIELDS = {
},
[FIELD_IDS.CREDIT_PERIOD]: {
LABEL: 'What credit period do you have with your buyer?',
HINT: 'To get a quote, you need to enter a credit period of 1 or 2 months, whichever is closest to your current credit period length.',
HINT: [
{
text: 'You can get an online quote for credit periods up to 2 months. If you need a credit period of over 2 months',
},
{
text: 'fill in this form',
href: LINKS.EXTERNAL.NBI_FORM,
},
{
text: 'and email it to UKEF.',
},
],
SUMMARY: {
TITLE: 'Credit period',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,19 @@ context('Tell us about your multi policy page - as an exporter, I want to provid
});

field.hint().should('exist');

const { HINT } = FIELDS[fieldId];

field.hint().invoke('text').then((text) => {
expect(text.trim()).equal(FIELDS[fieldId].HINT);
const expectedHintText = `${HINT[0].text} ${HINT[1].text} ${HINT[2].text}`;

expect(text.trim()).equal(expectedHintText);
});

const expectedHintHref = HINT[1].href;

field.hintLink().should('have.attr', 'href', expectedHintHref);

field.input().should('exist');
});

Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cypress/e2e/pages/quote/tellUsAboutYourPolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const tellUsAboutYourPolicyPage = {
label: () => cy.get(`[data-cy="${FIELD_IDS.CREDIT_PERIOD}-label"]`),
labelText: () => cy.get(`[data-cy="${FIELD_IDS.CREDIT_PERIOD}-label"]`),
hint: () => cy.get(`[data-cy="${FIELD_IDS.CREDIT_PERIOD}-hint"]`),
hintLink: () => cy.get(`[data-cy="${FIELD_IDS.CREDIT_PERIOD}-hint-link"]`),
input: () => cy.get(`[data-cy="${FIELD_IDS.CREDIT_PERIOD}-input"]`),
errorMessage: () => cy.get(`[data-cy="${FIELD_IDS.CREDIT_PERIOD}-error-message"]`),
},
Expand Down
13 changes: 12 additions & 1 deletion src/ui/server/content-strings/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ export const FIELDS = {
},
[FIELD_IDS.CREDIT_PERIOD]: {
LABEL: 'What credit period do you have with your buyer?',
HINT: 'To get a quote, you need to enter a credit period of 1 or 2 months, whichever is closest to your current credit period length.',
HINT: [
{
text: 'You can get an online quote for credit periods up to 2 months. If you need a credit period of over 2 months',
},
{
text: 'fill in this form',
href: LINKS.EXTERNAL.NBI_FORM,
},
{
text: 'and email it to UKEF.',
},
],
SUMMARY: {
TITLE: 'Credit period',
},
Expand Down
1 change: 0 additions & 1 deletion src/ui/templates/quote/policy-type.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
{% import '../components/details-text.njk' as detailsText %}
{% from "govuk/components/button/macro.njk" import govukButton %}
{% from "govuk/components/error-message/macro.njk" import govukErrorMessage %}
{% import '../components/details-text.njk' as detailsText %}

{% block pageTitle %}
{{ CONTENT_STRINGS.PAGE_TITLE }}
Expand Down
9 changes: 5 additions & 4 deletions src/ui/templates/quote/tell-us-about-your-policy.njk
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,15 @@
}
}) }}

{% set creditPeriodHintHtml %}
<p data-cy="{{ FIELDS.CREDIT_PERIOD.ID }}-hint">{{ FIELDS.CREDIT_PERIOD.HINT[0].text }} <a class="govuk-link" href="{{ FIELDS.CREDIT_PERIOD.HINT[1].href }}" data-cy="{{ FIELDS.CREDIT_PERIOD.ID }}-hint-link">{{ FIELDS.CREDIT_PERIOD.HINT[1].text }}</a> {{ FIELDS.CREDIT_PERIOD.HINT[2].text }}</p>
{% endset %}

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
{{ govukHint({
id: FIELDS.CREDIT_PERIOD.ID + "-hint",
text: FIELDS.CREDIT_PERIOD.HINT,
attributes: {
"data-cy": FIELDS.CREDIT_PERIOD.ID + "-hint"
}
html: creditPeriodHintHtml
}) }}
</div>
</div>
Expand Down

0 comments on commit 4b53c9c

Please sign in to comment.