diff --git a/src/app/components/common/toggle-shared/toggle-shared.component.html b/src/app/components/common/toggle-shared/toggle-shared.component.html index 5ad56b496..cc718ef1d 100644 --- a/src/app/components/common/toggle-shared/toggle-shared.component.html +++ b/src/app/components/common/toggle-shared/toggle-shared.component.html @@ -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" > link diff --git a/src/app/components/common/toggle-shared/toggle-shared.component.spec.ts b/src/app/components/common/toggle-shared/toggle-shared.component.spec.ts index 65754048b..6aa7804bb 100644 --- a/src/app/components/common/toggle-shared/toggle-shared.component.spec.ts +++ b/src/app/components/common/toggle-shared/toggle-shared.component.spec.ts @@ -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'); + }); }); diff --git a/src/app/components/common/toggle-shared/toggle-shared.component.ts b/src/app/components/common/toggle-shared/toggle-shared.component.ts index af7011ff9..1a865f52f 100644 --- a/src/app/components/common/toggle-shared/toggle-shared.component.ts +++ b/src/app/components/common/toggle-shared/toggle-shared.component.ts @@ -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'; + } }