Updated and tested all buttons

This commit is contained in:
alexjanousekGSA
2025-07-02 18:14:22 -04:00
parent bee667a5e9
commit 3e2fe8be04
31 changed files with 34 additions and 34 deletions

View File

@@ -65,7 +65,7 @@
return $(`<div class="selection-footer${stickyClass} margin-top-2">
<button
class="govuk-button govuk-button--secondary selection-footer__button usa-button usa-button--outline"
class="usa-button usa-button--outline selection-footer__button"
aria-expanded="${expanded ? 'true' : 'false'}"
aria-controls="${this.fieldsetId}">
${buttonContent}
@@ -214,7 +214,7 @@
CollapsibleCheckboxes.prototype.bindEvents = function() {
const self = this;
this.$formGroup.on('click', '.govuk-button', this.handleClick.bind(this));
this.$formGroup.on('click', '.usa-button', this.handleClick.bind(this));
this.$checkboxes.on('click', this.handleSelection.bind(this));
this.summary.bindEvents(this);

View File

@@ -80,14 +80,14 @@
$('.copy-to-clipboard__value', component)[0], () =>
$component
.html(states.valueCopied(stateOptions))
.find('.govuk-button').focus()
.find('.usa-button').focus()
)
)
.on(
'click', '.copy-to-clipboard__button--show', () =>
$component
.html(states.valueVisible(stateOptions))
.find('.govuk-button').focus()
.find('.usa-button').focus()
);
if ('stickAtBottomWhenScrolling' in GOVUK) {

View File

@@ -37,14 +37,14 @@
' {{{sharedAttributes}}}' +
'/>' +
'{{#button}}' +
'<button type="button" class="govuk-button govuk-button--secondary input-list__button--remove">' +
'<button type="button" class="usa-button input-list__button--remove">' +
'Remove<span class="usa-sr-only"> {{listItemName}} number {{number}}</span>' +
'</button>' +
'{{/button}}' +
'</div>'
);
ListEntry.prototype.addButtonTemplate = Hogan.compile(
'<button type="button" class="govuk-button govuk-button--secondary input-list__button--add">Add another {{listItemName}} ({{entriesLeft}} remaining)</button>'
'<button type="button" class="usa-button input-list__button--add">Add another {{listItemName}} ({{entriesLeft}} remaining)</button>'
);
ListEntry.prototype.getSharedAttributes = function () {
var $inputs = this.$wrapper.find('input'),

View File

@@ -17,7 +17,7 @@
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
{% set button_data = {"text": button_text} %}
{% if destructive %}{% set _ = button_data.update({"classes": "govuk-button--warning page-footer__button"}) %}{% endif %}
{% if destructive %}{% set _ = button_data.update({"classes": "usa-button usa-button--secondary page-footer__button"}) %}{% endif %}
{% if centered_button %}{% set _ = button_data.update({"classes": "page-footer__button--centred"}) %}{% endif %}
{% if button_name %}{% set _ = button_data.update({"name": button_name}) %}{% endif %}
{% if button_value %}{% set _ = button_data.update({"value": button_value}) %}{% endif %}

View File

@@ -61,7 +61,7 @@
"element": "a",
"text": "Create an API key",
"href": url_for('.create_api_key', service_id=current_service.id),
"classes": "govuk-button--secondary"
"classes": "usa-button"
}) }}
</div>

View File

@@ -34,7 +34,7 @@
"element": "a",
"text": "New organization",
"href": url_for('main.add_organization'),
"classes": "govuk-button--secondary"
"classes": "usa-button"
}) }}
</div>

View File

@@ -68,7 +68,7 @@
"element": "a",
"text": "Invite team member",
"href": url_for('.invite_org_user', org_id=current_org.id),
"classes": "govuk-button--secondary"
"classes": "usa-button"
}) }}
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 KiB

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 KiB

After

Width:  |  Height:  |  Size: 532 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB

After

Width:  |  Height:  |  Size: 353 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 938 KiB

After

Width:  |  Height:  |  Size: 938 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 KiB

After

Width:  |  Height:  |  Size: 476 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 KiB

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 KiB

After

Width:  |  Height:  |  Size: 381 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 KiB

After

Width:  |  Height:  |  Size: 468 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 KiB

After

Width:  |  Height:  |  Size: 452 KiB

View File

@@ -64,7 +64,7 @@ def test_organization_page_shows_all_organizations(
assert normalize_spaces(archived.parent.text) == "Test 2 - archived 2 live services"
assert (
normalize_spaces(page.select_one("a.govuk-button--secondary").text)
normalize_spaces(page.select_one("a.usa-button").text)
== "New organization"
)
get_organizations.assert_called_once_with()

View File

@@ -122,7 +122,7 @@ describe('Collapsible fieldset', () => {
test("has a button to expand the fieldset", () => {
const button = formGroup.querySelector('.govuk-button');
const button = formGroup.querySelector('.usa-button');
expect(button).not.toBeNull();
expect(button.textContent.trim()).toEqual('Choose folders');
@@ -131,7 +131,7 @@ describe('Collapsible fieldset', () => {
test("has the correct aria attributes on the button", () => {
expect(helpers.element(formGroup.querySelector('.govuk-button')).hasAttributesSetTo({
expect(helpers.element(formGroup.querySelector('.usa-button')).hasAttributesSetTo({
'aria-controls': fieldset.getAttribute('id'),
'aria-expanded': 'false'
})).toBe(true);
@@ -231,7 +231,7 @@ describe('Collapsible fieldset', () => {
// start module
window.GOVUK.modules.start();
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
});
@@ -249,13 +249,13 @@ describe('Collapsible fieldset', () => {
test("it uses ARIA to mark the checkboxes as expanded", () => {
expect(formGroup.querySelector('.govuk-button').getAttribute('aria-expanded')).toEqual('true');
expect(formGroup.querySelector('.usa-button').getAttribute('aria-expanded')).toEqual('true');
});
test("it changes it's text to indicate it's new action", () => {
expect(formGroup.querySelector('.govuk-button').textContent.trim()).toEqual("Done choosing folders");
expect(formGroup.querySelector('.usa-button').textContent.trim()).toEqual("Done choosing folders");
});
@@ -269,10 +269,10 @@ describe('Collapsible fieldset', () => {
window.GOVUK.modules.start();
// show the checkboxes
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
// click the button
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
});
@@ -290,13 +290,13 @@ describe('Collapsible fieldset', () => {
test("it uses ARIA to mark the checkboxes as collapsed", () => {
expect(formGroup.querySelector('.govuk-button').getAttribute('aria-expanded')).toEqual('false');
expect(formGroup.querySelector('.usa-button').getAttribute('aria-expanded')).toEqual('false');
});
test("it changes it's text to indicate it's new action", () => {
expect(formGroup.querySelector('.govuk-button').textContent.trim()).toEqual("Choose folders");
expect(formGroup.querySelector('.usa-button').textContent.trim()).toEqual("Choose folders");
});
});
@@ -311,7 +311,7 @@ describe('Collapsible fieldset', () => {
window.GOVUK.modules.start();
// show the checkboxes
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
expect(formGroup.querySelector('.selection-footer').previousElementSibling.nodeName).toBe('FIELDSET');
@@ -329,7 +329,7 @@ describe('Collapsible fieldset', () => {
window.GOVUK.modules.start();
// show the checkboxes
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
expect(formGroup.querySelector('.selection-footer').previousElementSibling.nodeName).toBe('FIELDSET');
@@ -348,7 +348,7 @@ describe('Collapsible fieldset', () => {
window.GOVUK.modules.start();
// show the checkboxes
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
});
@@ -361,7 +361,7 @@ describe('Collapsible fieldset', () => {
test("is removed when the fieldset is collapsed", () => {
// click the button to collapse the fieldset
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
expect(formGroup.querySelector('.selection-footer').classList.contains('js-stick-at-bottom-when-scrolling')).toBe(false);
@@ -376,7 +376,7 @@ describe('Collapsible fieldset', () => {
beforeEach(() => {
window.GOVUK.modules.start();
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
});
test("adds a 'Select all' button when checkboxes are shown", () => {
@@ -420,7 +420,7 @@ describe('Collapsible fieldset', () => {
test("button is hidden when fieldset is collapsed", () => {
const toggleButton = document.querySelector('.usa-button--small');
const doneButton = formGroup.querySelector('.govuk-button');
const doneButton = formGroup.querySelector('.usa-button');
expect(toggleButton.parentElement.style.display).not.toEqual('none');
@@ -436,13 +436,13 @@ describe('Collapsible fieldset', () => {
test("shows toggle button again when fieldset is re-opened", () => {
window.GOVUK.modules.start();
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
const toggleButton = document.querySelector('.usa-button--small');
expect(toggleButton).not.toBeNull();
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
const toggleButtonAfter = document.querySelector('.usa-button--small');
expect(toggleButtonAfter).not.toBeNull();
@@ -454,7 +454,7 @@ describe('Collapsible fieldset', () => {
describe("when the selection changes", () => {
const showCheckboxes = () => {
helpers.triggerEvent(formGroup.querySelector('.govuk-button'), 'click');
helpers.triggerEvent(formGroup.querySelector('.usa-button'), 'click');
};
const checkFirstCheckbox = () => {

View File

@@ -25,7 +25,7 @@ describe('File upload', () => {
Upload logo
</label>
<label class="file-upload-filename" for="file"></label>
<button type="submit" class="govuk-button file-upload-submit">Submit</button>
<button type="submit" class="usa-button file-upload-submit">Submit</button>
</form>`;
form = document.querySelector('form');

View File

@@ -19,7 +19,7 @@ describe('Prevent duplicate form submissions', () => {
// set up DOM
document.body.innerHTML = `
<form action="/" method="post">
<button class="govuk-button" type="submit">Continue</button>
<button class="usa-button" type="submit">Continue</button>
</form>`;
form = document.querySelector('form');

View File

@@ -91,7 +91,7 @@ describe("Stick to top/bottom of window when scrolling", () => {
</div>
</div>
<div class="page-footer">
<button type="submit" class="govuk-button">Continue</button>
<button type="submit" class="usa-button">Continue</button>
</div>
</form>
</main>
@@ -756,7 +756,7 @@ describe("Stick to top/bottom of window when scrolling", () => {
</div>
<div class="page-footer js-stick-at-bottom-when-scrolling">
<form method="post" action="">
<button type="submit" class="govuk-button">Send 1 email </button>
<button type="submit" class="usa-button">Send 1 email </button>
</form>
</div>
</div>