diff --git a/lib/process-services/attachment/task-attachment-list.component.html b/lib/process-services/attachment/task-attachment-list.component.html index 203052c212..1ef1247b1f 100644 --- a/lib/process-services/attachment/task-attachment-list.component.html +++ b/lib/process-services/attachment/task-attachment-list.component.html @@ -6,10 +6,10 @@ (executeRowAction)="onExecuteRowAction($event)"> -
+
{{'ADF_TASK_LIST.ATTACHMENT.EMPTY.HEADER' | translate}}
-
+
diff --git a/lib/process-services/attachment/task-attachment-list.component.spec.ts b/lib/process-services/attachment/task-attachment-list.component.spec.ts index f38c96cc17..80da68842c 100644 --- a/lib/process-services/attachment/task-attachment-list.component.spec.ts +++ b/lib/process-services/attachment/task-attachment-list.component.spec.ts @@ -96,9 +96,7 @@ describe('TaskAttachmentList', () => { deleteContentSpy = spyOn(service, 'deleteRelatedContent').and.returnValue(Observable.of({successCode: true})); let blobObj = new Blob(); - getFileRawContentSpy = spyOn(service, 'getFileRawContent').and.returnValue(Observable.of( - blobObj; - + getFileRawContentSpy = spyOn(service, 'getFileRawContent').and.returnValue(Observable.of(blobObj)); }); it('should load attachments when taskId specified', () => { @@ -152,7 +150,7 @@ describe('TaskAttachmentList', () => { expect(getFileRawContentSpy).toHaveBeenCalled(); }); - it('should show the empty list drag and drop component when the task is not completed', async(() => { + it('should show the empty default message when has no custom template', async(() => { getTaskRelatedContentSpy.and.returnValue(Observable.of({ 'size': 0, 'total': 0, @@ -161,24 +159,7 @@ describe('TaskAttachmentList', () => { })); let change = new SimpleChange(null, '123', true); component.ngOnChanges({ 'taskId': change }); - component.disabled = false; - - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(fixture.nativeElement.querySelector('.adf-custom-empty-template')).not.toBeNull(); - }); - })); - - it('should not show the empty list drag and drop component when is disabled', async(() => { - getTaskRelatedContentSpy.and.returnValue(Observable.of({ - 'size': 0, - 'total': 0, - 'start': 0, - 'data': [] - })); - let change = new SimpleChange(null, '123', true); - component.ngOnChanges({ 'taskId': change }); - component.disabled = true; + component.hasCustomTemplate = false; fixture.whenStable().then(() => { fixture.detectChanges(); @@ -187,6 +168,23 @@ describe('TaskAttachmentList', () => { }); })); + it('should not show the custom empty message when has custom template', async(() => { + getTaskRelatedContentSpy.and.returnValue(Observable.of({ + 'size': 0, + 'total': 0, + 'start': 0, + 'data': [] + })); + let change = new SimpleChange(null, '123', true); + component.ngOnChanges({ 'taskId': change }); + component.hasCustomTemplate = true; + + fixture.whenStable().then(() => { + fixture.detectChanges(); + expect(fixture.nativeElement.querySelector('.adf-custom-empty-template')).not.toBeNull(); + }); + })); + it('should display all actions if attachments are not read only', () => { let change = new SimpleChange(null, '123', true); component.ngOnChanges({ 'taskId': change }); diff --git a/lib/process-services/attachment/task-attachment-list.component.ts b/lib/process-services/attachment/task-attachment-list.component.ts index f291df18fc..b190c4f856 100644 --- a/lib/process-services/attachment/task-attachment-list.component.ts +++ b/lib/process-services/attachment/task-attachment-list.component.ts @@ -42,9 +42,10 @@ export class TaskAttachmentListComponent implements OnChanges, AfterViewInit { @Output() error: EventEmitter = new EventEmitter(); - hasCustomTemplate: boolean; + hasCustomTemplate: boolean = false; - @ViewChild('customEmptyListTemplate') customTemplateRef: ElementRef; + @ViewChild('customEmptyListTemplate') + customTemplateRef: ElementRef; attachments: any[] = []; isLoading: boolean = true; @@ -66,7 +67,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterViewInit { this.customTemplateRef.nativeElement.children && this.customTemplateRef.nativeElement.children.length > 0) { this.hasCustomTemplate = true; } - } + } reset(): void { this.attachments = [];