mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1981] Continous loading of task details if task list is empty
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
(executeRowAction)="onExecuteRowAction($event)">
|
||||
|
||||
<adf-empty-list *ngIf="isEmpty()">
|
||||
<div adf-empty-list-header class="adf-empty-list-header" *ngIf="!isCustomTemplateDefined()">
|
||||
<div *ngIf="!isCustomTemplateDefined()" adf-empty-list-header class="adf-empty-list-header">
|
||||
{{'ADF_TASK_LIST.ATTACHMENT.EMPTY.HEADER' | translate}}
|
||||
</div>
|
||||
<div *ngIf="!isDisabled()" #customEmptyListTemplate class="adf-custom-empty-template">
|
||||
<div *ngIf="isCustomTemplateDefined()" #customEmptyListTemplate class="adf-custom-empty-template">
|
||||
<ng-content select="[adf-empty-list]"></ng-content>
|
||||
</div>
|
||||
</adf-empty-list>
|
||||
|
@@ -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 });
|
||||
|
@@ -42,9 +42,10 @@ export class TaskAttachmentListComponent implements OnChanges, AfterViewInit {
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
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 = [];
|
||||
|
Reference in New Issue
Block a user