Skip to content

Commit

Permalink
Merge pull request #1631 from ministryofjustice/i-cannot-spell
Browse files Browse the repository at this point in the history
Fix template name for Check you can sign page
  • Loading branch information
hawx authored Nov 19, 2024
2 parents 3bda7a9 + c22179f commit dafa547
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 7 deletions.
37 changes: 37 additions & 0 deletions cypress/e2e/donor/check-you-can-sign.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
describe('Check you can sign', () => {
describe('first time', () => {
beforeEach(() => {
cy.visit('/fixtures?redirect=/check-you-can-sign');
});

it('can be submitted', () => {
cy.checkA11yApp();
cy.contains('a', 'Return to task list').should('not.exist');

cy.get('#f-yes-no').check({ force: true });

cy.contains('button', 'Save and continue').click();
cy.url().should('contain', '/your-preferred-language');
});

it('errors when empty', () => {
cy.contains('button', 'Save and continue').click();

cy.get('.govuk-error-summary').within(() => {
cy.contains('Select yes if you will be able to sign the LPA yourself');
});

cy.contains('fieldset .govuk-error-message', 'Select yes if you will be able to sign the LPA yourself');
});
});

describe('after completing', () => {
beforeEach(() => {
cy.visit('/fixtures?redirect=/check-you-can-sign&progress=chooseYourAttorneys');
});

it('shows task list button', () => {
cy.contains('a', 'Return to task list');
});
});
});
12 changes: 7 additions & 5 deletions internal/donor/donorpage/check_you_can_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ import (
)

type checkYouCanSignData struct {
App appcontext.Data
Errors validation.List
Form *form.YesNoForm
App appcontext.Data
Errors validation.List
Form *form.YesNoForm
CanTaskList bool
}

func CheckYouCanSign(tmpl template.Template, donorStore DonorStore) Handler {
return func(appData appcontext.Data, w http.ResponseWriter, r *http.Request, provided *donordata.Provided) error {
data := &checkYouCanSignData{
App: appData,
Form: form.NewYesNoForm(provided.Donor.CanSign),
App: appData,
Form: form.NewYesNoForm(provided.Donor.CanSign),
CanTaskList: !provided.Type.Empty(),
}

if r.Method == http.MethodPost {
Expand Down
9 changes: 7 additions & 2 deletions web/template/donor/check_you_can_sign.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@

{{ trHtml .App "ifYouCannotTickTheBoxGuidance" }}

{{ template "radios-fielset" (fieldset . .Form.FieldName .Form.YesNo.String
{{ template "radios-fieldset" (fieldset . .Form.FieldName .Form.YesNo.String
(legend "willYouBeAbleToSign" "govuk-fieldset__legend--m")
(item .Form.Options.Yes.String "yesByddaf")
(item .Form.Options.No.String "noNaFyddaf" "hint" "wellGiveYouMoreInformationAboutWhatToDo")
) }}

{{ template "continue-button" . }}
{{ if .CanTaskList }}
{{ template "buttons" (button .App "saveAndContinue") }}
{{ else }}
{{ template "button" (button .App "saveAndContinue") }}
{{ end }}

{{ template "csrf-field" . }}
</form>
</div>
Expand Down

0 comments on commit dafa547

Please sign in to comment.