Skip to content

Commit

Permalink
Merge pull request #2002 from ORCID/fix/8693-qa-assistive-text-missin…
Browse files Browse the repository at this point in the history
…g-in-professional-activities-section

fix: Add missing assistive text to professional activities and sort type
  • Loading branch information
leomendoza123 authored Jul 5, 2023
2 parents 9f62db2 + 667d992 commit 6b8240b
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/app/cdk/panel/panels/panels.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ <h3 class="activity-header orc-font-body-large">
mat-menu-item
(click)="sortChange(option)"
*ngFor="let option of sortTypes"
[attr.aria-label]="option | appPanelsSortByAriaLabel"
>
{{ option | sortLabel }}
<mat-icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export class AppPanelsAddAriaLabelPipe implements PipeTransform {
transform(panelType: any, args?: any): string {
if (panelType == 'employment') {
return $localize`:@@shared.employmentAddAriaLabel:Add employment`
} else if (panelType == 'professional-activities') {
return $localize`:@@shared.addProfessionalActivity:Add a professional activity `
} else if (panelType == 'education' || panelType == 'qualification') {
return $localize`:@@shared.educationQualificationAddAriaLabel:Add education or qualification`
} else if (panelType == 'distinction' || panelType == 'invited-position') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export class AppPanelsSortAriaLabelPipe implements PipeTransform {
$localize`:@@shared.employmentSortAriaLabel:Sort your employment` +
disabledStr
)
} else if (panelType === 'professional-activities') {
return (
$localize`:@@shared.sortProfessionalActivities:Sort your professional activities` +
disabledStr
)
} else if (panelType === 'education' || panelType === 'qualification') {
return (
$localize`:@@shared.educationQualificationSortAriaLabel:Sort your education and qualifications` +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { AppPanelsSortByAriaLabelPipe } from './app-panels-sort-by-aria-label.pipe';

describe('AppPanelsSortByAriaLabelPipe', () => {
it('create an instance', () => {
const pipe = new AppPanelsSortByAriaLabelPipe();
expect(pipe).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Pipe, PipeTransform } from '@angular/core';
import { SortOrderType } from '../../../types/sort'

@Pipe({
name: 'appPanelsSortByAriaLabel'
})
export class AppPanelsSortByAriaLabelPipe implements PipeTransform {

transform(sortBy: SortOrderType): string {
switch (sortBy) {
case 'title':
return $localize`:@@shared.sortTitle:Sort by title`
case 'start':
return $localize`:@@shared.sortStart:Sort by start date`
case 'end':
return $localize`:@@shared.sortEnd:Sort by end date`
case 'date':
return $localize`:@@shared.sortDate:Sort by type`
case 'type':
return $localize`:@@shared.sortType:Sort by type`
case 'order':
return $localize`:@@shared.sortOrder:Sort by order`
}
}
}
5 changes: 4 additions & 1 deletion src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ import { AppPanelActivityActionAriaLabelPipe } from './pipes/app-panel-activity-
import { SortByPipe } from './pipes/sort-by/sort-by.pipe'
import { AffiliationLabelPipe } from './pipes/affiliation-label.pipe'
import { AffiliationTypePipe } from './pipes/affiliation-type/affiliation-type.pipe'
import { ScopePathTypePipe } from './pipes/scope-path-type/scope-path-type.pipe'
import { ScopePathTypePipe } from './pipes/scope-path-type/scope-path-type.pipe';
import { AppPanelsSortByAriaLabelPipe } from './pipes/app-panels-sort-by-aria-label/app-panels-sort-by-aria-label.pipe'
@NgModule({
imports: [
CommonModule,
Expand Down Expand Up @@ -97,6 +98,7 @@ import { ScopePathTypePipe } from './pipes/scope-path-type/scope-path-type.pipe'
AffiliationLabelPipe,
AffiliationTypePipe,
ScopePathTypePipe,
AppPanelsSortByAriaLabelPipe,
],
exports: [
CommonModule,
Expand Down Expand Up @@ -143,6 +145,7 @@ import { ScopePathTypePipe } from './pipes/scope-path-type/scope-path-type.pipe'
SortByPipe,
AffiliationTypePipe,
ScopePathTypePipe,
AppPanelsSortByAriaLabelPipe,
],
providers: [], // Should not provide anything
})
Expand Down
8 changes: 8 additions & 0 deletions src/locale/properties/shared/shared.en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -598,3 +598,11 @@ share.selfService=Self Service - ORCID
share.orcidTitle=- ORCID
share.myOrcidTitle=- My ORCID
share.developerTools=Developer tools - ORCID
shared.addProfessionalActivity=Add a professional activity
shared.sortProfessionalActivities=Sort your professional activities
shared.sortTitle=Sort by title
shared.sortStart=Sort by start date
shared.sortEnd=Sort by end date
shared.sortType=Sort by type
shared.sortDate=Sort by type
shared.sortOrder=Sort by order

0 comments on commit 6b8240b

Please sign in to comment.