mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
accessibility (#1689)
This commit is contained in:
@@ -17,10 +17,8 @@
|
||||
mat-icon-button
|
||||
data-automation-id="share-action-button"
|
||||
(click)="editSharedNode(selection)"
|
||||
[attr.title]="
|
||||
(isShared(selection) ? 'APP.ACTIONS.SHARE_EDIT' : 'APP.ACTIONS.SHARE')
|
||||
| translate
|
||||
"
|
||||
[attr.aria-label]="getLabel(selection) | translate"
|
||||
[attr.title]="getLabel(selection) | translate"
|
||||
>
|
||||
<mat-icon>link</mat-icon>
|
||||
</button>
|
||||
|
@@ -72,4 +72,19 @@ describe('ToggleSharedComponent', () => {
|
||||
component.editSharedNode({ first: { entry } });
|
||||
expect(storeMock.dispatch).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should get action label for unshared file', () => {
|
||||
component.ngOnInit();
|
||||
const label = component.getLabel({ first: { entry } });
|
||||
|
||||
expect(label).toBe('APP.ACTIONS.SHARE');
|
||||
});
|
||||
|
||||
it('should get action label for shared file', () => {
|
||||
entry.properties['qshare:sharedId'] = 'some-id';
|
||||
component.ngOnInit();
|
||||
const label = component.getLabel({ first: { entry } });
|
||||
|
||||
expect(label).toBe('APP.ACTIONS.SHARE_EDIT');
|
||||
});
|
||||
});
|
||||
|
@@ -56,4 +56,8 @@ export class ToggleSharedComponent implements OnInit {
|
||||
editSharedNode(selection: SelectionState) {
|
||||
this.store.dispatch(new ShareNodeAction(selection.first));
|
||||
}
|
||||
|
||||
getLabel(selection: SelectionState): string {
|
||||
return this.isShared(selection) ? 'APP.ACTIONS.SHARE_EDIT' : 'APP.ACTIONS.SHARE';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user