From 2a895a2cb26d18c9cc5ff1f7e395cb39305ce9a2 Mon Sep 17 00:00:00 2001 From: LucasHengelhaupt Date: Thu, 29 Jun 2023 18:09:14 +0200 Subject: [PATCH] feat: use aria-labels in forms --- .../cost-center-budget.component.html | 2 +- .../cost-center-budget.component.spec.ts | 22 ++--------- ...st-center-buyer-edit-dialog.component.html | 8 +--- .../user-budget/user-budget.component.html | 2 +- .../user-budget/user-budget.component.spec.ts | 32 ++-------------- .../cost-center-buyers-page.component.ts | 2 + .../requisitions-list.component.html | 5 ++- .../requisition-reject-dialog.component.html | 8 +--- .../address-doctor-modal.component.html | 8 +--- ...r-template-detail-line-item.component.html | 2 +- ...template-preferences-dialog.component.html | 8 +--- ...select-order-template-modal.component.html | 8 +--- ...ct-notification-edit-dialog.component.html | 8 +--- .../oci-configuration-form.component.ts | 6 +++ .../quickorder-csv-form.component.html | 2 +- ...product-add-to-quote-dialog.component.html | 8 +--- .../quote-edit/quote-edit.component.html | 12 +++--- ...roduct-review-create-dialog.component.html | 8 +--- .../select-wishlist-modal.component.html | 8 +--- ...wishlist-preferences-dialog.component.html | 8 +--- .../cookies-modal.component.html | 8 +--- .../cookies-modal.component.spec.ts | 7 +++- .../basket-address-summary.component.html | 6 +-- .../basket-buyer/basket-buyer.component.html | 2 +- ...sket-invoice-address-widget.component.html | 2 +- ...ket-shipping-address-widget.component.html | 2 +- .../breadcrumb/breadcrumb.component.html | 2 +- .../in-place-edit.component.spec.ts | 38 ++++--------------- .../common/info-box/info-box.component.html | 2 +- .../modal-dialog-link.component.html | 2 +- .../modal-dialog-link.component.spec.ts | 6 +-- .../modal-dialog/modal-dialog.component.html | 8 +--- .../common/paging/paging.component.html | 12 ++++-- .../common/paging/paging.component.spec.ts | 2 + .../filter-dropdown.component.spec.ts | 24 ++---------- .../login-modal/login-modal.component.html | 9 +---- .../product-list-toolbar.component.html | 4 +- .../product-quantity.component.html | 2 +- .../product-quantity.component.spec.ts | 18 +++------ .../promotion-details.component.html | 6 ++- .../confirm-leave-modal.component.html | 2 +- .../header-default.component.spec.ts.snap | 36 +++++++++++++++--- .../header-default.component.html | 6 ++- .../header-navigation.component.html | 6 ++- .../login-status/login-status.component.html | 20 +++++++--- .../sub-category-navigation.component.html | 4 +- .../sub-category-navigation.component.spec.ts | 30 +++------------ src/assets/i18n/de_DE.json | 25 ++++++++++-- src/assets/i18n/en_US.json | 23 +++++++++-- src/assets/i18n/fr_FR.json | 29 +++++++++++--- 50 files changed, 218 insertions(+), 292 deletions(-) diff --git a/projects/organization-management/src/app/components/cost-center-budget/cost-center-budget.component.html b/projects/organization-management/src/app/components/cost-center-budget/cost-center-budget.component.html index d59d35800e..f8eef700fc 100644 --- a/projects/organization-management/src/app/components/cost-center-budget/cost-center-budget.component.html +++ b/projects/organization-management/src/app/components/cost-center-budget/cost-center-budget.component.html @@ -6,7 +6,7 @@ [ngClass]="{ 'bg-danger': spentBudgetPercentage * 100 > 90 }" [ngStyle]="{ width: progressBarWidth | percent }" role="progressbar" - [attr.aria-label]="'Spent budget of cost center ' + costCenter.name" + [attr.aria-label]="'account.budget.already_spent.costcenter.aria_label' | translate : { '0': costCenter.name }" [attr.aria-valuetext]="spentBudgetPercentage | percent" > {{ spentBudgetPercentage | percent }} diff --git a/projects/organization-management/src/app/components/cost-center-budget/cost-center-budget.component.spec.ts b/projects/organization-management/src/app/components/cost-center-budget/cost-center-budget.component.spec.ts index d6b09f43b8..4c074ceee4 100644 --- a/projects/organization-management/src/app/components/cost-center-budget/cost-center-budget.component.spec.ts +++ b/projects/organization-management/src/app/components/cost-center-budget/cost-center-budget.component.spec.ts @@ -1,6 +1,7 @@ import { SimpleChange, SimpleChanges } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; +import { TranslateModule } from '@ngx-translate/core'; import { CostCenter } from 'ish-core/models/cost-center/cost-center.model'; @@ -14,7 +15,7 @@ describe('Cost Center Budget Component', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [NgbPopoverModule], + imports: [NgbPopoverModule, TranslateModule.forRoot()], declarations: [CostCenterBudgetComponent], }).compileComponents(); }); @@ -58,23 +59,6 @@ describe('Cost Center Budget Component', () => { it('should display budget progress bar when rendering', () => { component.ngOnChanges(basketChange); fixture.detectChanges(); - - expect(element).toMatchInlineSnapshot(` -
-
-
-
- 40% -
-
-
-
- `); + expect(element.querySelector('[data-testing-id="cost-center-budget-popover"]')).toBeTruthy(); }); }); diff --git a/projects/organization-management/src/app/components/cost-center-buyer-edit-dialog/cost-center-buyer-edit-dialog.component.html b/projects/organization-management/src/app/components/cost-center-buyer-edit-dialog/cost-center-buyer-edit-dialog.component.html index a593f7490c..e45afbc5ba 100644 --- a/projects/organization-management/src/app/components/cost-center-buyer-edit-dialog/cost-center-buyer-edit-dialog.component.html +++ b/projects/organization-management/src/app/components/cost-center-buyer-edit-dialog/cost-center-buyer-edit-dialog.component.html @@ -1,13 +1,7 @@ diff --git a/projects/organization-management/src/app/components/user-budget/user-budget.component.html b/projects/organization-management/src/app/components/user-budget/user-budget.component.html index 5b4c33a7b0..c813ad28fd 100644 --- a/projects/organization-management/src/app/components/user-budget/user-budget.component.html +++ b/projects/organization-management/src/app/components/user-budget/user-budget.component.html @@ -25,7 +25,7 @@ [ngClass]="{ 'bg-danger': usedBudgetPercentage * 100 > 90 }" [ngStyle]="{ width: usedBudgetPercentage | percent }" role="progressbar" - aria-label="Spent budget" + [attr.aria-label]="'account.budget.already_spent.label' | translate" [attr.aria-valuetext]="usedBudgetPercentage | percent" > {{ usedBudgetPercentage | percent }} diff --git a/projects/organization-management/src/app/components/user-budget/user-budget.component.spec.ts b/projects/organization-management/src/app/components/user-budget/user-budget.component.spec.ts index 574f1e41bb..f726a035f5 100644 --- a/projects/organization-management/src/app/components/user-budget/user-budget.component.spec.ts +++ b/projects/organization-management/src/app/components/user-budget/user-budget.component.spec.ts @@ -61,35 +61,9 @@ describe('User Budget Component', () => { component.ngOnChanges(); fixture.detectChanges(); - expect(element).toMatchInlineSnapshot(` -
-
-
account.user.new.order_spend_limit.label
-
USD 100
-
-
-
account.budget.label
-
USD 5000
-
-
-
account.budget.already_spent.label
-
USD 2500
-
-
-
-
- 50% -
-
-
-
- `); + expect(element.textContent).toContain( + 'account.user.new.order_spend_limit.label USD 100 account.budget.labelUSD 5000account.budget.already_spent.labelUSD 250050%' + ); }); it('should return 2500 used budget when remaining budget is 2500', () => { diff --git a/projects/organization-management/src/app/pages/cost-center-buyers/cost-center-buyers-page.component.ts b/projects/organization-management/src/app/pages/cost-center-buyers/cost-center-buyers-page.component.ts index 65b759446b..7edcb0a8cc 100644 --- a/projects/organization-management/src/app/pages/cost-center-buyers/cost-center-buyers-page.component.ts +++ b/projects/organization-management/src/app/pages/cost-center-buyers/cost-center-buyers-page.component.ts @@ -105,6 +105,7 @@ export class CostCenterBuyersPageComponent implements OnDestroy, OnInit { className: 'col-1 col-md-2 list-item pb-0', props: { fieldClass: 'offset-md-2 col-2 mt-1', + ariaLabel: 'Select buyer to add to costcenter', }, }, { @@ -125,6 +126,7 @@ export class CostCenterBuyersPageComponent implements OnDestroy, OnInit { addonLeft: { text: this.appFacade.currencySymbol$(), }, + ariaLabel: 'Buyer budget', }, validators: { validation: [SpecialValidators.moneyAmount], diff --git a/projects/requisition-management/src/app/components/requisitions-list/requisitions-list.component.html b/projects/requisition-management/src/app/components/requisitions-list/requisitions-list.component.html index 98c5c1de68..77aa060eac 100644 --- a/projects/requisition-management/src/app/components/requisitions-list/requisitions-list.component.html +++ b/projects/requisition-management/src/app/components/requisitions-list/requisitions-list.component.html @@ -15,7 +15,10 @@ *cdkCellDef="let requisition" [attr.data-label]="'account.approvallist.table.id_of_order' | translate" > - + {{ requisition.requisitionNo }} diff --git a/projects/requisition-management/src/app/pages/requisition-detail/requisition-reject-dialog/requisition-reject-dialog.component.html b/projects/requisition-management/src/app/pages/requisition-detail/requisition-reject-dialog/requisition-reject-dialog.component.html index 131ea5a4ab..f65659ee25 100644 --- a/projects/requisition-management/src/app/pages/requisition-detail/requisition-reject-dialog/requisition-reject-dialog.component.html +++ b/projects/requisition-management/src/app/pages/requisition-detail/requisition-reject-dialog/requisition-reject-dialog.component.html @@ -2,13 +2,7 @@