mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ACA-3960] FE - Users that are part of a candidate group should not be able to see 'Assignee' property as editable when on that user task candidate group was set as assignment (#6159)
* [ACA-3960] FE - Users that are part of a candidate group should not be able to see 'Assignee' property as editable when on that user task candidate group was set as assignment * * Added description
This commit is contained in:
parent
b0a46f7eac
commit
c84ef7318f
@ -19,7 +19,7 @@ import { TaskHeaderCloudComponent } from './task-header-cloud.component';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||
import { setupTestBed, AppConfigService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { setupTestBed, AppConfigService, AlfrescoApiService, CardViewArrayItem } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
import { TaskHeaderCloudModule } from '../task-header-cloud.module';
|
||||
@ -216,6 +216,17 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
const loading = fixture.debugElement.query(By.css('.adf-task-header-loading'));
|
||||
expect(loading).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not render edit icon if the task in assigned state and assingned user is different from current logged-in user', () => {
|
||||
isTaskEditableSpy.and.returnValue(false);
|
||||
fixture.detectChanges();
|
||||
const priorityEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-priority"]`));
|
||||
const descriptionEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-description"]`));
|
||||
const dueDateEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="datepickertoggle-dueDate"]`));
|
||||
expect(priorityEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(descriptionEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(dueDateEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Task with parentTaskId', () => {
|
||||
@ -268,7 +279,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
expect(statusEl.nativeElement.value).toBe('ASSIGNED');
|
||||
});
|
||||
|
||||
it('should render defined edit icon for assignee property if the task in assigned state and shared among candidates', async () => {
|
||||
it('should render defined edit icon for assignee property if the task in assigned state and shared among candidate users', async () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
const value = fixture.debugElement.query(By.css(`[data-automation-id="header-assignee"] [data-automation-id="card-textitem-clickable-icon-assignee"]`));
|
||||
@ -276,7 +287,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
expect(value.nativeElement.innerText).toBe('create');
|
||||
});
|
||||
|
||||
it('should not render defined edit icon for assignee property if the task in created state and shared among condidates', async () => {
|
||||
it('should not render defined edit icon for assignee property if the task in created state and shared among condidate users', async () => {
|
||||
getTaskByIdSpy.and.returnValue(of(createdTaskDetailsCloudMock));
|
||||
|
||||
component.ngOnChanges();
|
||||
@ -287,6 +298,28 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
expect(editIcon).toBeNull();
|
||||
});
|
||||
|
||||
it('should not render defined edit icon for assignee property if the task in assigned state and shared among candidate groups', async () => {
|
||||
component.candidateGroups = <CardViewArrayItem[]> [{ value: 'mock-group-1', icon: 'edit' }, { value: 'mock-group-2', icon: 'edit' }];
|
||||
component.candidateUsers = [];
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
const value = fixture.debugElement.query(By.css(`[data-automation-id="header-assignee"] [data-automation-id="card-textitem-clickable-icon-assignee"]`));
|
||||
expect(value).not.toBeNull();
|
||||
expect(value.nativeElement.innerText).toBe('create');
|
||||
});
|
||||
|
||||
it('should not render defined edit icon for assignee property if the task in created state and shared among condidate groups', async () => {
|
||||
getTaskByIdSpy.and.returnValue(of(createdTaskDetailsCloudMock));
|
||||
component.candidateGroups = <CardViewArrayItem[]> [{ value: 'mock-group-1', icon: 'edit' }, { value: 'mock-group-2', icon: 'edit' }];
|
||||
component.candidateUsers = [];
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
const editIcon = fixture.debugElement.query(By.css(`[data-automation-id="header-assignee"] [data-automation-id="card-textitem-clickable-icon-assignee"]`));
|
||||
expect(editIcon).toBeNull();
|
||||
});
|
||||
|
||||
it('should render edit icon if the task in assigned state and assingee should be current user', () => {
|
||||
fixture.detectChanges();
|
||||
const priorityEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="header-priority"] [class*="adf-textitem-edit-icon"]`));
|
||||
@ -304,17 +337,6 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
const value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-clickable-icon-assignee"]`));
|
||||
expect(value).toBeNull('Edit icon should NOT be shown');
|
||||
});
|
||||
|
||||
it('should not render edit icon if the task in assigned state and assingned user is different from current logged-in user', () => {
|
||||
isTaskEditableSpy.and.returnValue(false);
|
||||
fixture.detectChanges();
|
||||
const priorityEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-priority"]`));
|
||||
const descriptionEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-description"]`));
|
||||
const dueDateEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="datepickertoggle-dueDate"]`));
|
||||
expect(priorityEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(descriptionEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(dueDateEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Created Task', () => {
|
||||
|
@ -318,8 +318,12 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
return this.taskCloudService.isTaskEditable(this.taskDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* as per [ACA-3960] it required an empty array argument for now
|
||||
* Empty array will be replaced with candidateGroups in feature
|
||||
*/
|
||||
isAssigneePropertyClickable(): boolean {
|
||||
return this.taskCloudService.isAssigneePropertyClickable(this.taskDetails, this.candidateUsers, this.candidateGroups);
|
||||
return this.taskCloudService.isAssigneePropertyClickable(this.taskDetails, this.candidateUsers, []);
|
||||
}
|
||||
|
||||
private isValidSelection(filteredProperties: string[], cardItem: CardViewBaseItemModel): boolean {
|
||||
|
Loading…
x
Reference in New Issue
Block a user