mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2238] added a condition to avoid checklist delete for completed task
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<mat-chip-list class="mat-chip-list-stacked">
|
||||
<mat-chip id="check-{{check.id}}" class="adf-checklist-chip" *ngFor="let check of checklist">
|
||||
<span>{{check.name}}</span>
|
||||
<button *ngIf="!readOnly" mat-icon-button type="button" class="adf-checklist-cancel-button" (click)="delete(check.id)">
|
||||
<button *ngIf="!readOnly && !check.endDate" mat-icon-button type="button" class="adf-checklist-cancel-button" (click)="delete(check.id)">
|
||||
<mat-icon id="remove-{{check.id}}" matChipRemove>cancel</mat-icon>
|
||||
</button>
|
||||
</mat-chip>
|
||||
|
@@ -29,6 +29,12 @@ const fakeTaskDetail = new TaskDetailsModel({
|
||||
name: 'fake-check-name'
|
||||
});
|
||||
|
||||
const fakeTaskDetailCompleted = new TaskDetailsModel({
|
||||
id: 'fake-completed-id',
|
||||
name: 'fake-completed-name',
|
||||
endDate: '2018-05-23T11:25:14.552+0000'
|
||||
});
|
||||
|
||||
describe('ChecklistComponent', () => {
|
||||
|
||||
let checklistComponent: ChecklistComponent;
|
||||
@@ -146,6 +152,16 @@ describe('ChecklistComponent', () => {
|
||||
expect(element.querySelector('#check-fake-check-id').textContent).toContain('fake-check-name');
|
||||
});
|
||||
|
||||
it('should not show delete icon when checklist task is completed', () => {
|
||||
checklistComponent.checklist.push(fakeTaskDetail);
|
||||
checklistComponent.checklist.push(fakeTaskDetailCompleted);
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#remove-fake-check-id')).not.toBeNull();
|
||||
expect(element.querySelector('#check-fake-completed-id')).not.toBeNull();
|
||||
expect(element.querySelector('#check-fake-completed-id')).toBeDefined();
|
||||
expect(element.querySelector('#remove-fake-completed-id')).toBeNull();
|
||||
});
|
||||
|
||||
it('should add checklist', async(() => {
|
||||
showChecklistDialog.click();
|
||||
let addButtonDialog = <HTMLElement> window.document.querySelector('#add-check');
|
||||
|
Reference in New Issue
Block a user