Skip to content

Commit

Permalink
SCRATCH - demo contextual answer vs change strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-saunders-cts committed Jan 24, 2025
1 parent 5c78bd6 commit b2bc266
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/resources/cy/translation/applicant/name.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"content2": "Dylai eich enw fod union yr un fath ag y mae wedi’i ysgrifennu ar eich pasbort neu fath arall o ddogfen adnabod awdurdodedig, er enghraifft trwydded yrru.",
"content3": "Dylech wneud yn siŵr mai dyma’r un math o brawf adnabod a ddefnyddiwch pan fyddwch yn delio ag ystad yr unigolyn sydd wedi marw.",
"firstName": "Enw cyntaf ac unrhyw enwau canol",
"changeFirstName": "Welsh - Change your first or middle names",
"answerFirstName": "Welsh - Provide your first or middle names",
"lastName": "Cyfenw",
"warningText": "Os nad yw’r enw ar y grant yn cyfateb i’r prawf adnabod a ddefnyddiwch, efallai y cewch anawsterau wrth ddelio â’r ystad.",

Expand Down
2 changes: 2 additions & 0 deletions app/resources/cy/translation/language.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"title": "Grant language",
"question": "Hoffech chi grant dwyieithog, sef Cymraeg a Saesneg?",
"a11yChange": "Welsh - Change bilingual grant required",
"a11yAnswer": "Welsh - Is a bilingual grant required",
"optionYes": "Hoffwn",
"optionNo": "Na hoffwn",

Expand Down
2 changes: 2 additions & 0 deletions app/resources/en/translation/applicant/name.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"content2": "Your name should match exactly what is written on your passport or other official identification document, such as a driving licence.",
"content3": "You should make sure that this is the same form of identification you use when you are dealing with the estate of the person who died.",
"firstName": "First name and any middle names",
"changeFirstName": "English - Change your first or middle names",
"answerFirstName": "English - Provide your first or middle names",
"lastName": "Last name",
"warningText": "If the name on the grant does not match the identification you use, you may have difficulties dealing with the estate.",

Expand Down
2 changes: 2 additions & 0 deletions app/resources/en/translation/language.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"title": "Select the language for the Grant",
"question": "Do you require a bilingual grant in English and Welsh?",
"a11yChange": "English - Change bilingual grant required",
"a11yAnswer": "English - Is a bilingual grant required",
"optionYes": "Yes",
"optionNo": "No",

Expand Down
8 changes: 8 additions & 0 deletions app/steps/ui/applicant/name/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ class ApplicantName extends ValidationStep {
static getUrl() {
return '/applicant-name';
}

generateContent(ctx, formdata, language = 'en') {
const superContent = super.generateContent(ctx, formdata, language);

superContent.answerFirstName = superContent.answerFirstName + ' dynamic=' + Math.floor(Math.random() * 10);
superContent.changeFirstName = superContent.changeFirstName + ' dynamic=' + Math.floor(Math.random() * 10);
return superContent;
}
}

module.exports = ApplicantName;
4 changes: 4 additions & 0 deletions app/steps/ui/summary/includes/deceased.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
{
question: content.BilingualGOP.question,
answer: content.BilingualGOP[fields.language.bilingual.value],
a11yCtx: {
change: content.BilingualGOP.a11yChange,
answer: content.BilingualGOP.a11yAnswer
},
visible: true
}
],
Expand Down
4 changes: 4 additions & 0 deletions app/steps/ui/summary/includes/executors-applicant.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
{
question: content.ApplicantName.firstName,
answer: fields.applicant.firstName.value,
a11yCtx: {
change: content.ApplicantName.changeFirstName,
answer: content.ApplicantName.answerFirstName
},
visible: true
},
{
Expand Down
2 changes: 1 addition & 1 deletion test/component/applicant/testApplicantName.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('applicant-name', () => {
testWrapper.agent.post('/prepare-session/form')
.send(sessionData)
.end(() => {
testWrapper.testContent(done);
testWrapper.testContent(done, {}, ['changeFirstName', 'answerFirstName']);
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/component/testLanguage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('bilingual-gop', () => {
testCommonContent.runTest('BilingualGOP');

it('test content loaded on the page', (done) => {
testWrapper.testContent(done);
testWrapper.testContent(done, {}, ['a11yChange', 'a11yAnswer']);
});

it('test errors message displayed for missing data', (done) => {
Expand Down

0 comments on commit b2bc266

Please sign in to comment.