Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PP-11883 Update cancel link to be a button #3924

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/assets/sass/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
@import "modules/3ds";
@import "modules/accepted-cards";
@import "modules/accessible-autocomplete";
@import "modules/button-reset";
@import "modules/cvc";
@import "modules/expiry-date-separator";
@import "modules/input-confirm";
Expand Down
26 changes: 0 additions & 26 deletions app/assets/sass/modules/_button-reset.scss

This file was deleted.

9 changes: 8 additions & 1 deletion app/views/charge.njk
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,14 @@
</form>
<form id="cancel" name="cancel" method="POST" action="{{ post_cancel_action }}" class="form" novalidate>
<div>
<input id="cancel-payment" type="submit" class="button-reset" value="{{ __p("commonButtons.cancelButton") }}" name="cancel">
{{ govukButton({
text: __p("commonButtons.cancelButton"),
classes: "govuk-button--secondary",
attributes: {
id: "cancel-payment",
name: "cancel"
}
}) }}
<input id="csrf2" name="csrfToken" type="hidden" value="{{ csrf }}"/>
</div>
</form>
Expand Down
9 changes: 8 additions & 1 deletion app/views/confirm.njk
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@

<form id="cancel" name="cancel" method="POST" action="{{ post_cancel_action }}" class="form" novalidate>
<div>
<input id="cancel-payment" type="submit" class="button-reset" value="{{ __p("commonButtons.cancelButton") }}" name="cancel">
{{ govukButton({
text: __p("commonButtons.cancelButton"),
classes: "govuk-button--secondary",
attributes: {
id: "cancel-payment",
name: "cancel"
}
}) }}
<input id="csrf2" name="csrfToken" type="hidden" value="{{ csrf }}"/>
</div>
</form>
Expand Down
2 changes: 1 addition & 1 deletion test/charge-ui.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,6 @@ describe('The confirm view', function () {

it('should have a \'Cancel\' button.', function () {
const body = renderTemplate('charge', {})
body.should.containInputWithIdAndName('cancel-payment', 'cancel', 'submit')
body.should.containButtonWithIdAndName('cancel-payment', 'cancel', 'submit')
})
})
5 changes: 5 additions & 0 deletions test/test-helpers/html-assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ chai.use(function (_chai, utils) {
utils.flag(this, 'inputFieldId', id)
})

chai.Assertion.addMethod('containButtonWithIdAndName', function (id, name, type) {
this.containSelector('button#' + id).withAttributes({ name: name, type: type })
utils.flag(this, 'buttonId', id)
})

chai.Assertion.addMethod('withLabel', function (labelId, labelText) {
const inputFieldId = utils.flag(this, 'inputFieldId')
const subAssertion = new chai.Assertion(utils.flag(this, 'rawHtml'))
Expand Down
Loading