Skip to content

Commit

Permalink
MLPAB-1094 Add summary cards for actors (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawx authored Oct 12, 2023
1 parent b84b946 commit abe7c64
Show file tree
Hide file tree
Showing 28 changed files with 336 additions and 412 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/donor/choose-attorneys-address.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ describe('Choose attorneys address', () => {
cy.contains('label', 'Use an address you’ve already entered').click();
cy.contains('button', 'Continue').click();

cy.contains('label', '2 RICHMOND PLACE').click();
cy.contains('label', '1 RICHMOND PLACE').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/choose-attorneys-summary');

cy.get('#attorney-address-2').should('contain', '2 RICHMOND PLACE');
cy.contains('.govuk-summary-card', 'Robin Redcar').should('contain', '1 RICHMOND PLACE');
});
});
13 changes: 8 additions & 5 deletions cypress/e2e/donor/choose-attorneys-summary.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Choose attorneys summary', () => {
it('can amend attorney details', () => {
cy.checkA11yApp();

cy.get('#attorney-name-1').contains('a', 'Change').click();
cy.contains('.govuk-summary-card', 'Jessie Jones').contains('a', 'Change').click();

cy.url().should('contain', '/choose-attorneys?from=');
cy.url().should('contain', '/choose-attorneys-summary');
Expand All @@ -45,7 +45,10 @@ describe('Choose attorneys summary', () => {
it('can amend attorney address', () => {
cy.checkA11yApp();

cy.get('#attorney-address-2').contains('a', 'Change').click();
cy.contains('.govuk-summary-card', 'Robin Redcar')
.contains('.govuk-summary-list__row', 'Address')
.contains('a', 'Change')
.click();

cy.url().should('contain', '/choose-attorneys-address?from=');
cy.url().should('contain', '/choose-attorneys-summary');
Expand Down Expand Up @@ -104,7 +107,7 @@ describe('Choose attorneys summary', () => {
it('can remove an attorney', () => {
cy.checkA11yApp();

cy.get('#remove-attorney-1').contains('a', 'Remove').click();
cy.contains('.govuk-summary-card', 'Jessie Jones').contains('a', 'Remove').click();

cy.url().should('contain', '/remove-attorney');
cy.url().should('match', /id=\w*/);
Expand All @@ -122,15 +125,15 @@ describe('Choose attorneys summary', () => {

cy.get('main').should('not.contain', 'Jessie Jones');

cy.get('#remove-attorney-1').contains('a', 'Remove').click();
cy.contains('.govuk-summary-card', 'Robin Redcar').contains('a', 'Remove').click();
cy.get('input[name="yes-no"]').check('yes');
cy.contains('button', 'Continue').click();

cy.url().should('contain', '/choose-attorneys');
});

it('errors when remove not selected', () => {
cy.get('#remove-attorney-1').contains('a', 'Remove').click();
cy.contains('.govuk-summary-card', 'Jessie Jones').contains('a', 'Remove').click();

cy.contains('button', 'Continue').click();

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/donor/choose-people-to-notify-address.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ describe('People to notify address', () => {

cy.url().should('contain', '/choose-people-to-notify-summary');

cy.get('#address-1').should('contain', '5 RICHMOND PLACE');
cy.contains('.govuk-summary-card', 'Jordan Jefferson').should('contain', '5 RICHMOND PLACE');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ describe('Choose replacement attorneys address', () => {

cy.url().should('contain', '/choose-replacement-attorneys-summary');

cy.get('#replacement-address-2').should('contain', '2 RICHMOND PLACE');
cy.contains('.govuk-summary-card', 'Taylor Thompson').should('contain', '2 RICHMOND PLACE');
});
});
13 changes: 8 additions & 5 deletions cypress/e2e/donor/choose-replacement-attorneys-summary.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Choose replacement attorneys summary', () => {
it('can amend attorney details', () => {
cy.checkA11yApp();

cy.get('#replacement-name-1').contains('a', 'Change').click();
cy.contains('.govuk-summary-card', 'Blake Buckley').contains('a', 'Change').click();
cy.get('#f-first-names').clear().type('Mark');

cy.contains('button', 'Save and continue').click();
Expand All @@ -39,7 +39,10 @@ describe('Choose replacement attorneys summary', () => {
it('can amend attorney address', () => {
cy.checkA11yApp();

cy.get('#replacement-address-2').contains('a', 'Change').click();
cy.contains('.govuk-summary-card', 'Taylor Thompson')
.contains('.govuk-summary-list__row', 'Address')
.contains('a', 'Change')
.click();

cy.get('#f-address-line-1').clear().type('4 RICHMOND PLACE');
cy.contains('button', 'Continue').click();
Expand Down Expand Up @@ -90,7 +93,7 @@ describe('Choose replacement attorneys summary', () => {
it('can remove an attorney', () => {
cy.checkA11yApp();

cy.get('#remove-replacement-1').contains('a', 'Remove').click();
cy.contains('.govuk-summary-card', 'Blake Buckley').contains('a', 'Remove').click();

cy.url().should('contain', '/remove-replacement-attorney');
cy.url().should('match', /id=\w*/);
Expand All @@ -108,15 +111,15 @@ describe('Choose replacement attorneys summary', () => {

cy.get('main').should('not.contain', 'Blake Buckley');

cy.get('#remove-replacement-1').contains('a', 'Remove').click();
cy.contains('.govuk-summary-card', 'Taylor Thompson').contains('a', 'Remove').click();
cy.get('input[name="yes-no"]').check('yes');
cy.contains('button', 'Continue').click();

cy.url().should('contain', '/do-you-want-replacement-attorneys');
});

it('errors when remove not selected', () => {
cy.contains('a', 'Remove Blake Buckley').click();
cy.contains('.govuk-summary-card', 'Blake Buckley').contains('a', 'Remove').click();

cy.contains('button', 'Continue').click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ describe('Enter replacement trust corporation address', () => {
cy.contains('label', 'Use an address you’ve already entered').click();
cy.contains('button', 'Continue').click();

cy.contains('label', '2 RICHMOND PLACE').click();
cy.contains('label', '1 RICHMOND PLACE').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/choose-replacement-attorneys-summary');

cy.get('#trust-corporation-address').should('contain', '2 RICHMOND PLACE');
cy.contains('.govuk-summary-card', 'First Choice Trust Corporation Ltd.').should('contain', '1 RICHMOND PLACE');
});
});
4 changes: 2 additions & 2 deletions cypress/e2e/donor/enter-trust-corporation-address.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ describe('Enter trust corporation address', () => {
cy.contains('label', 'Use an address you’ve already entered').click();
cy.contains('button', 'Continue').click();

cy.contains('label', '2 RICHMOND PLACE').click();
cy.contains('label', '1 RICHMOND PLACE').click();
cy.contains('button', 'Save and continue').click();

cy.url().should('contain', '/choose-attorneys-summary');

cy.get('#trust-corporation-address').should('contain', '2 RICHMOND PLACE');
cy.contains('.govuk-summary-card', 'First Choice Trust Corporation Ltd.').contains('1 RICHMOND PLACE');
});
});
1 change: 0 additions & 1 deletion cypress/e2e/donor/lpa-progress.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
describe('LPA progress', () => {
it('when nothing completed', () => {
cy.visit('/fixtures?redirect=/progress');
cy.checkA11yApp();

cy.contains('li', 'You’ve signed your LPA In progress');
cy.contains('li', 'Your certificate provider has provided their certificate Not started');
Expand Down
36 changes: 19 additions & 17 deletions cypress/e2e/donor/people-to-notify.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ describe('People to notify', () => {

cy.contains('People to notify about your LPA');

cy.get('#name-1').contains('Brian Gooding');
cy.get('#address-1').contains("4 RICHMOND PLACE");
cy.get('#address-1').contains("BIRMINGHAM");
cy.get('#address-1').contains("B14 7ED");
cy.contains('.govuk-summary-card', 'Brian Gooding').within(() => {
cy.contains('Brian Gooding');
cy.contains("4 RICHMOND PLACE");
cy.contains("BIRMINGHAM");
cy.contains("B14 7ED");
});

cy.get('input[name="yes-no"]').check('yes')
cy.contains('button', 'Save and continue').click();
Expand All @@ -66,7 +68,7 @@ describe('People to notify', () => {

cy.checkA11yApp();

cy.contains('Jordan Jefferson').parent().contains('a', 'Change').click();
cy.contains('.govuk-summary-list__row', 'Jordan Jefferson').contains('a', 'Change').click();

cy.url().should('contain', '/choose-people-to-notify');

Expand All @@ -80,10 +82,8 @@ describe('People to notify', () => {

cy.url().should('contain', '/choose-people-to-notify-summary');

cy.get('#name-1').contains('Changed Altered')
cy.get('#email-1').contains(TestEmail2)

cy.contains('4 RICHMOND PLACE').parent().contains('a', 'Change').click();
cy.contains('.govuk-summary-card', 'Changed Altered').contains(TestEmail2);
cy.contains('.govuk-summary-list__row', '4 RICHMOND PLACE').contains('a', 'Change').click();

cy.url().should('contain', '/choose-people-to-notify-address');

Expand All @@ -99,19 +99,21 @@ describe('People to notify', () => {

cy.url().should('contain', '/choose-people-to-notify-summary');

cy.get('#address-1').contains('1 New Road');
cy.get('#address-1').contains('Changeville');
cy.get('#address-1').contains('Newington');
cy.get('#address-1').contains('Newshire');
cy.get('#address-1').contains('A12 3BC');
cy.contains('.govuk-summary-card', 'Changed Altered').within(() => {
cy.contains('1 New Road');
cy.contains('Changeville');
cy.contains('Newington');
cy.contains('Newshire');
cy.contains('A12 3BC');
});
});

it('can remove a person to notify', () => {
cy.visit('/fixtures?redirect=/choose-people-to-notify-summary&progress=peopleToNotifyAboutYourLpa');

cy.checkA11yApp();

cy.get('#remove-person-to-notify-2').contains(`Remove Danni Davies`).click();
cy.contains('.govuk-summary-card', 'Danni Davies').contains('Remove person to notify').click();

cy.url().should('contain', '/remove-person-to-notify');

Expand All @@ -122,7 +124,7 @@ describe('People to notify', () => {

cy.url().should('contain', '/choose-people-to-notify-summary');

cy.get('#remove-person-to-notify-1').contains(`Remove Jordan Jefferson`).click();
cy.contains('.govuk-summary-card', 'Jordan Jefferson').contains('Remove person to notify').click();

cy.url().should('contain', '/remove-person-to-notify');

Expand Down Expand Up @@ -205,7 +207,7 @@ describe('People to notify', () => {
cy.contains('.govuk-fieldset .govuk-error-message', 'Select yes to add another person to notify');
});

it.only('warns when name shared with other actor', () => {
it('warns when name shared with other actor', () => {
cy.visit('/fixtures?redirect=/choose-people-to-notify&progress=provideYourDetails');

cy.get('#f-first-names').type('Sam');
Expand Down
3 changes: 3 additions & 0 deletions internal/page/fixtures/attorney.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ func Attorney(
ThinksCanSign: actor.Yes,
CanSign: form.Yes,
}

lpa.Type = page.LpaTypePropertyFinance
if lpaType == "hw" && !isTrustCorporation {
lpa.Type = page.LpaTypeHealthWelfare
}

lpa.CertificateProvider = makeCertificateProvider()

lpa.Attorneys = actor.Attorneys{
Attorneys: []actor.Attorney{makeAttorney(attorneyNames[0])},
TrustCorporation: makeTrustCorporation("First Choice Trust Corporation Ltd."),
Expand Down
9 changes: 0 additions & 9 deletions internal/templatefn/fn.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func All(tag, region string) map[string]any {
"listAttorneys": listAttorneys,
"warning": warning,
"listPeopleToNotify": listPeopleToNotify,
"peopleNamedOnLpa": peopleNamedOnLpa,
"possessive": possessive,
"card": card,
"printStruct": printStruct,
Expand Down Expand Up @@ -318,14 +317,6 @@ func warning(app page.AppData, content string) map[string]interface{} {
}
}

func peopleNamedOnLpa(app page.AppData, lpa *page.Lpa, headingLevel int) map[string]interface{} {
return map[string]interface{}{
"App": app,
"Lpa": lpa,
"HeadingLevel": headingLevel,
}
}

func card(app page.AppData, item any) map[string]any {
return map[string]interface{}{
"App": app,
Expand Down
16 changes: 0 additions & 16 deletions internal/templatefn/fn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,22 +342,6 @@ func TestListPeopleToNotify(t *testing.T) {
assert.Equal(t, want, got)
}

func TestListPeopleNamedOnLpa(t *testing.T) {
app := page.AppData{SessionID: "abc"}
headingLevel := 3
lpa := &page.Lpa{}

want := map[string]interface{}{
"App": app,
"HeadingLevel": headingLevel,
"Lpa": lpa,
}

got := peopleNamedOnLpa(app, lpa, headingLevel)

assert.Equal(t, want, got)
}

func TestCard(t *testing.T) {
app := page.AppData{SessionID: "abc"}

Expand Down
5 changes: 4 additions & 1 deletion lang/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -886,5 +886,8 @@
"sendItByPost" : "Welsh",
"theirLpa": "{{.FullNamePossessive}} {{.LpaType}} Welsh",
"allAttorneysHaveSignedTheLpa": "Welsh",
"youveSignedTheLpa": "Welsh"
"youveSignedTheLpa": "Welsh",
"sendItByPost" : "Welsh",
"removeAttorney": "Welsh",
"removePersonToNotify": "Welsh"
}
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -836,5 +836,7 @@
"sendItByPost" : "Send it by post",
"theirLpa": "{{.FullNamePossessive}} {{.LpaType}} LPA",
"allAttorneysHaveSignedTheLpa": "All attorneys have signed the LPA",
"youveSignedTheLpa": "You’ve signed the LPA"
"youveSignedTheLpa": "You’ve signed the LPA",
"removeAttorney": "Remove attorney",
"removePersonToNotify": "Remove person to notify"
}
16 changes: 2 additions & 14 deletions web/template/attorney_confirm_your_details.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">{{ tr .App "address" }}</dt>
<dd class="govuk-summary-list__value">
{{ .TrustCorporation.Address.Line1 }}<br>
{{ if .TrustCorporation.Address.Line2 }}{{ .TrustCorporation.Address.Line2 }}<br>{{end}}
{{ if .TrustCorporation.Address.Line3 }}{{ .TrustCorporation.Address.Line3 }}<br>{{end}}
{{ if .TrustCorporation.Address.TownOrCity }}{{ .TrustCorporation.Address.TownOrCity }}<br>{{end}}
{{ .TrustCorporation.Address.Postcode }}
</dd>
<dd class="govuk-summary-list__value">{{ template "address-lines" .TrustCorporation.Address }}</dd>
</div>
</dl>

Expand All @@ -66,13 +60,7 @@
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">{{ tr .App "address" }}</dt>
<dd class="govuk-summary-list__value">
{{ .Attorney.Address.Line1 }}<br>
{{ if .Attorney.Address.Line2 }}{{ .Attorney.Address.Line2 }}<br>{{end}}
{{ if .Attorney.Address.Line3 }}{{ .Attorney.Address.Line3 }}<br>{{end}}
{{ if .Attorney.Address.TownOrCity }}{{ .Attorney.Address.TownOrCity }}<br>{{end}}
{{ .Attorney.Address.Postcode }}
</dd>
<dd class="govuk-summary-list__value">{{ template "address-lines" .Attorney.Address }}</dd>
</div>
</dl>

Expand Down
2 changes: 1 addition & 1 deletion web/template/attorney_progress.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<h2 class="govuk-heading-m">{{ tr .App "lpaDecisions"}}</h2>

{{ template "lpa-decisions" . }}
{{ template "people-named-on-lpa" (peopleNamedOnLpa .App .Lpa 0) }}
{{ template "people-named-on-lpa" . }}
</div>
</div>
{{ end }}
2 changes: 1 addition & 1 deletion web/template/attorney_read_the_lpa.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{{ tr .App "peopleNamedOnTheLpa" }}
</h2>

{{ template "people-named-on-lpa" (peopleNamedOnLpa .App .Lpa 0) }}
{{ template "people-named-on-lpa" . }}

<form novalidate method="post">
{{ template "continue-button" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">{{ tr .App "address" }}</dt>
<dd class="govuk-summary-list__value">
{{ .Lpa.CertificateProvider.Address.Line1 }}<br>
{{ if .Lpa.CertificateProvider.Address.Line2 }}{{ .Lpa.CertificateProvider.Address.Line2 }}<br>{{end}}
{{ if .Lpa.CertificateProvider.Address.Line3 }}{{ .Lpa.CertificateProvider.Address.Line3 }}<br>{{end}}
{{ if .Lpa.CertificateProvider.Address.TownOrCity }}{{ .Lpa.CertificateProvider.Address.TownOrCity }}<br>{{end}}
{{ .Lpa.CertificateProvider.Address.Postcode }}
</dd>
<dd class="govuk-summary-list__value">{{ template "address-lines" .Lpa.CertificateProvider.Address }}</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">{{ tr .App "mobileNumber" }}</dt>
Expand Down
2 changes: 1 addition & 1 deletion web/template/certificate_provider_read_the_lpa.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{{ tr .App "peopleNamedOnTheLpa" }}
</h2>

{{ template "people-named-on-lpa" (peopleNamedOnLpa .App .Lpa 0) }}
{{ template "people-named-on-lpa" . }}

<form novalidate method="post">
{{ template "continue-button" . }}
Expand Down
Loading

0 comments on commit abe7c64

Please sign in to comment.