From 41c83a9e54c7970e5aba41aee6be9299b0a2f9d4 Mon Sep 17 00:00:00 2001 From: Joshua Hawxwell Date: Wed, 18 Oct 2023 13:49:01 +0100 Subject: [PATCH] MLPAB-1255 Remove in some other way logic for step in page (#781) --- ...ow_should_replacement_attorneys_step_in.go | 12 ++--- ...ould_replacement_attorneys_step_in_test.go | 51 ++++++------------- lang/cy.json | 1 - lang/en.json | 1 - web/template/fixtures.gohtml | 40 ++++++++------- ...hould_replacement_attorneys_step_in.gohtml | 36 ++++++------- 6 files changed, 57 insertions(+), 84 deletions(-) diff --git a/internal/page/donor/how_should_replacement_attorneys_step_in.go b/internal/page/donor/how_should_replacement_attorneys_step_in.go index e6244b464f..b60826fe3f 100644 --- a/internal/page/donor/how_should_replacement_attorneys_step_in.go +++ b/internal/page/donor/how_should_replacement_attorneys_step_in.go @@ -9,18 +9,16 @@ import ( ) type howShouldReplacementAttorneysStepInData struct { - App page.AppData - Errors validation.List - AllowSomeOtherWay bool - Form *howShouldReplacementAttorneysStepInForm - Options page.ReplacementAttorneysStepInOptions + App page.AppData + Errors validation.List + Form *howShouldReplacementAttorneysStepInForm + Options page.ReplacementAttorneysStepInOptions } func HowShouldReplacementAttorneysStepIn(tmpl template.Template, donorStore DonorStore) Handler { return func(appData page.AppData, w http.ResponseWriter, r *http.Request, lpa *page.Lpa) error { data := &howShouldReplacementAttorneysStepInData{ - App: appData, - AllowSomeOtherWay: lpa.ReplacementAttorneys.Len() == 1, + App: appData, Form: &howShouldReplacementAttorneysStepInForm{ WhenToStepIn: lpa.HowShouldReplacementAttorneysStepIn, OtherDetails: lpa.HowShouldReplacementAttorneysStepInDetails, diff --git a/internal/page/donor/how_should_replacement_attorneys_step_in_test.go b/internal/page/donor/how_should_replacement_attorneys_step_in_test.go index 791a31ed81..f76e45762f 100644 --- a/internal/page/donor/how_should_replacement_attorneys_step_in_test.go +++ b/internal/page/donor/how_should_replacement_attorneys_step_in_test.go @@ -15,44 +15,25 @@ import ( ) func TestGetHowShouldReplacementAttorneysStepIn(t *testing.T) { - testcases := map[string]struct { - attorneys actor.Attorneys - allowSomeOtherWay bool - }{ - "single": { - attorneys: actor.Attorneys{Attorneys: []actor.Attorney{{}}}, - allowSomeOtherWay: true, - }, - "multiple": { - attorneys: actor.Attorneys{Attorneys: []actor.Attorney{{}, {}}}, - allowSomeOtherWay: false, - }, - } - - for name, tc := range testcases { - t.Run(name, func(t *testing.T) { - w := httptest.NewRecorder() - r, _ := http.NewRequest(http.MethodGet, "/", nil) + w := httptest.NewRecorder() + r, _ := http.NewRequest(http.MethodGet, "/", nil) - template := newMockTemplate(t) - template. - On("Execute", w, &howShouldReplacementAttorneysStepInData{ - App: testAppData, - AllowSomeOtherWay: tc.allowSomeOtherWay, - Form: &howShouldReplacementAttorneysStepInForm{}, - Options: page.ReplacementAttorneysStepInValues, - }). - Return(nil) + template := newMockTemplate(t) + template. + On("Execute", w, &howShouldReplacementAttorneysStepInData{ + App: testAppData, + Form: &howShouldReplacementAttorneysStepInForm{}, + Options: page.ReplacementAttorneysStepInValues, + }). + Return(nil) - err := HowShouldReplacementAttorneysStepIn(template.Execute, nil)(testAppData, w, r, &page.Lpa{ - ReplacementAttorneys: tc.attorneys, - }) - resp := w.Result() + err := HowShouldReplacementAttorneysStepIn(template.Execute, nil)(testAppData, w, r, &page.Lpa{ + ReplacementAttorneys: actor.Attorneys{Attorneys: []actor.Attorney{{}}}, + }) + resp := w.Result() - assert.Nil(t, err) - assert.Equal(t, http.StatusOK, resp.StatusCode) - }) - } + assert.Nil(t, err) + assert.Equal(t, http.StatusOK, resp.StatusCode) } func TestGetHowShouldReplacementAttorneysStepInFromStore(t *testing.T) { diff --git a/lang/cy.json b/lang/cy.json index e690652f28..db3fecf99f 100644 --- a/lang/cy.json +++ b/lang/cy.json @@ -423,7 +423,6 @@ "howYourReplacementAttorneysShouldStepIn": "Sut dylai eich atwrneiod wrth gefn gamu i mewn", "howShouldYourReplacementAttorneysStepIn": "Sut dylai eich atwrneiod wrth gefn gamu i mewn?", "howShouldReplacementAttorneysStepInDetailSomeOtherWay": "

Gallwch ddewis pryd fydd eich atwrneiod wrth gefn yn camu i mewn ac ym mha drefn.

Mae’r rhan fwyaf o roddwyr yn dewis i’w holl atwrneiod wrth gefn gamu i mewn ar yr un pryd, hynny yw, cyn gynted ag y bydd un o’u hatwrneiod gwreiddiol yn methu â gweithredu mwyach. Serch hynny, os byddai’n well gennych i’ch atwrneiod wrth gefn gamu i mewn yn hwyrach neu mewn trefn benodol, dewiswch un o’r 2 opsiwn arall.

", - "howShouldReplacementAttorneysStepInDetail": "

Gallwch ddewis pryd fydd eich atwrneiod wrth gefn yn camu i mewn ac ym mha drefn.

Mae’r rhan fwyaf o roddwyr yn dewis i’w holl atwrneiod wrth gefn gamu i mewn ar yr un pryd, hynny yw, cyn gynted ag y bydd un o’u hatwrneiod gwreiddiol yn methu â gweithredu mwyach. Serch hynny, os byddai’n well gennych i’ch atwrneiod wrth gefn gamu i mewn yn hwyrach neu mewn trefn benodol, dewiswch un o’r 2 opsiwn arall.

", "whenOneCanNoLongerAct": "Cyn gynted ag y bydd un o’ch atwrneiod gwreiddiol yn methu â gweithredu mwyach, dylai eich holl atwrneiod wrth gefn gamu i mewn ar yr un pryd. Byddant yn gallu gwneud penderfyniadau ar y cyd ac yn unigol.", "whenNoneCanNoLongerAct": "Pan na all unrhyw un o’ch atwrneiod gwreiddiol weithredu, bydd eich holl atwrneiod wrth gefn yn camu i mewn ar yr un pryd. Gallwch ddewis sut maen nhw’n gwneud penderfyniadau ar y dudalen nesaf.", "otherWay": "Mewn rhyw ffordd arall", diff --git a/lang/en.json b/lang/en.json index 673fe0bf1b..b55430ab1e 100644 --- a/lang/en.json +++ b/lang/en.json @@ -391,7 +391,6 @@ "howYourReplacementAttorneysShouldStepIn": "How your replacement attorneys should step in", "howShouldYourReplacementAttorneysStepIn": "How should your replacement attorneys step in?", "howShouldReplacementAttorneysStepInDetailSomeOtherWay": "

You can choose when your replacement attorneys step in and in what order.

Most donors choose for all their replacement attorneys to step in at the same time, as soon as one of their original attorneys can no longer act. However, if you would prefer your replacement attorneys to step in later or in a specific order, select one of the other 2 options.

", - "howShouldReplacementAttorneysStepInDetail": "

You can choose when your replacement attorneys step in and in what order.

Most donors choose for all their replacement attorneys to step in at the same time, as soon as one of their original attorneys can no longer act. However, if you would prefer your replacement attorneys to step in later or in a specific order, select the second option.

", "whenOneCanNoLongerAct": "As soon as one of your original attorneys can no longer act, all your replacement attorneys should step in at the same time. They will be able to make decisions jointly and severally.", "whenNoneCanNoLongerAct": "When none of your original attorneys can act, all your replacement attorneys will step in at the same time. You can choose how they make decisions on the next page.", "otherWay": "In some other way", diff --git a/web/template/fixtures.gohtml b/web/template/fixtures.gohtml index 814c456675..21db146ddc 100644 --- a/web/template/fixtures.gohtml +++ b/web/template/fixtures.gohtml @@ -35,26 +35,28 @@ -
- Progress +
+
+ Progress - {{ template "radios" (items . "progress" nil - (item "provideYourDetails" "provideYourDetails") - (item "chooseYourAttorneys" "chooseYourAttorneys") - (item "chooseYourReplacementAttorneys" "chooseYourReplacementAttorneys") - (item "Choose when the LPA can be used / Life-sustaining treatment" "chooseWhenTheLpaCanBeUsed") - (item "addRestrictionsToTheLpa" "addRestrictionsToTheLpa") - (item "chooseYourCertificateProvider" "chooseYourCertificateProvider") - (item "peopleToNotifyAboutYourLpa" "peopleToNotifyAboutYourLpa") - (item "checkAndSendToYourCertificateProvider" "checkAndSendToYourCertificateProvider") - (item "payForTheLpa" "payForTheLpa") - (item "confirmYourIdentityAndSignTheLpa" "confirmYourIdentityAndSignTheLpa") - (item "signedByCertificateProvider" "signedByCertificateProvider") - (item "signedByAttorneys" "signedByAttorneys") - (item "submitted" "submitted") - (item "registered" "registered") - ) }} -
+ {{ template "radios" (items . "progress" nil + (item "provideYourDetails" "provideYourDetails") + (item "chooseYourAttorneys" "chooseYourAttorneys") + (item "chooseYourReplacementAttorneys" "chooseYourReplacementAttorneys") + (item "Choose when the LPA can be used / Life-sustaining treatment" "chooseWhenTheLpaCanBeUsed") + (item "addRestrictionsToTheLpa" "addRestrictionsToTheLpa") + (item "chooseYourCertificateProvider" "chooseYourCertificateProvider") + (item "peopleToNotifyAboutYourLpa" "peopleToNotifyAboutYourLpa") + (item "checkAndSendToYourCertificateProvider" "checkAndSendToYourCertificateProvider") + (item "payForTheLpa" "payForTheLpa") + (item "confirmYourIdentityAndSignTheLpa" "confirmYourIdentityAndSign") + (item "signedByCertificateProvider" "Signed by certificate provider") + (item "signedByAttorneys" "Signed by attorneys") + (item "submitted" "Submitted") + (item "registered" "registered") + ) }} +
+ diff --git a/web/template/how_should_replacement_attorneys_step_in.gohtml b/web/template/how_should_replacement_attorneys_step_in.gohtml index 90cea6b66b..2a60a13487 100644 --- a/web/template/how_should_replacement_attorneys_step_in.gohtml +++ b/web/template/how_should_replacement_attorneys_step_in.gohtml @@ -7,11 +7,7 @@

{{ tr .App "whenYourReplacementAttorneysStepIn" }}

- {{ if .AllowSomeOtherWay }} - {{ trHtml .App "howShouldReplacementAttorneysStepInDetailSomeOtherWay" }} - {{ else }} - {{ trHtml .App "howShouldReplacementAttorneysStepInDetail" }} - {{ end }} + {{ trHtml .App "howShouldReplacementAttorneysStepInDetailSomeOtherWay" }}
@@ -35,25 +31,23 @@ {{ trHtml .App "whenNoneCanNoLongerAct" }}
- {{ if .AllowSomeOtherWay }} -
- - +
+ + -
-
-

{{ tr .App "otherWayHint" }}

- - {{ template "error-message" (errorMessage . "other-details") }} - -
+
+
+

{{ tr .App "otherWayHint" }}

+ + {{ template "error-message" (errorMessage . "other-details") }} +
- {{ end }} +