mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
[ACA-4384] [ADW] Empty template or error template should be displayed in case error occurred when clicking a folder (#2132)
* [ACA-4384] [ADW] Empty template or error template should be displayed in case error occurred when clicking a folder * * Fixed lint errors * * Removed the logic to check specific statuscode
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
(name-click)="navigateTo($event.detail?.node)"
|
(name-click)="navigateTo($event.detail?.node)"
|
||||||
(sorting-changed)="onSortingChanged($event)"
|
(sorting-changed)="onSortingChanged($event)"
|
||||||
(filterSelection)="onFilterSelected($event)"
|
(filterSelection)="onFilterSelected($event)"
|
||||||
|
(error)="onError()"
|
||||||
>
|
>
|
||||||
<data-columns>
|
<data-columns>
|
||||||
<ng-container *ngFor="let column of columns; trackBy: trackById">
|
<ng-container *ngFor="let column of columns; trackBy: trackById">
|
||||||
|
@@ -51,6 +51,7 @@ describe('FilesComponent', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let spyContent = null;
|
let spyContent = null;
|
||||||
|
let loadFolderByNodeIdSpy: jasmine.Spy;
|
||||||
|
|
||||||
function verifyEmptyFilterTemplate() {
|
function verifyEmptyFilterTemplate() {
|
||||||
const template = fixture.debugElement.query(By.css('.empty-search__block')).nativeElement as HTMLElement;
|
const template = fixture.debugElement.query(By.css('.empty-search__block')).nativeElement as HTMLElement;
|
||||||
@@ -91,7 +92,7 @@ describe('FilesComponent', () => {
|
|||||||
const fakeNodeEntry: NodeEntry = { entry: { id: 'fake-node-entry' } } as NodeEntry;
|
const fakeNodeEntry: NodeEntry = { entry: { id: 'fake-node-entry' } } as NodeEntry;
|
||||||
const fakeNodePaging: NodePaging = { list: { pagination: { count: 10, maxItems: 10, skipCount: 0 } } };
|
const fakeNodePaging: NodePaging = { list: { pagination: { count: 10, maxItems: 10, skipCount: 0 } } };
|
||||||
const documentLoaderNode = { children: fakeNodePaging, currentNode: fakeNodeEntry };
|
const documentLoaderNode = { children: fakeNodePaging, currentNode: fakeNodeEntry };
|
||||||
spyOn(documentListService, 'loadFolderByNodeId').and.returnValue(of(documentLoaderNode));
|
loadFolderByNodeIdSpy = spyOn(documentListService, 'loadFolderByNodeId').and.returnValue(of(documentLoaderNode));
|
||||||
|
|
||||||
uploadService = TestBed.inject(UploadService);
|
uploadService = TestBed.inject(UploadService);
|
||||||
router = TestBed.inject(Router);
|
router = TestBed.inject(Router);
|
||||||
@@ -128,6 +129,16 @@ describe('FilesComponent', () => {
|
|||||||
|
|
||||||
expect(component.isValidPath).toBe(true);
|
expect(component.isValidPath).toBe(true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should set current page as invalid path when loadFolderByNodeId API fails', fakeAsync(() => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
spyContent.and.returnValue(throwError(null));
|
||||||
|
loadFolderByNodeIdSpy.and.returnValue(throwError(Error('error')));
|
||||||
|
component.documentList.loadFolder();
|
||||||
|
tick();
|
||||||
|
|
||||||
|
expect(component.isValidPath).toBe(false);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OnInit', () => {
|
describe('OnInit', () => {
|
||||||
|
@@ -344,4 +344,8 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
|||||||
isFilterHeaderActive(): boolean {
|
isFilterHeaderActive(): boolean {
|
||||||
return this.showHeader === ShowHeaderMode.Always;
|
return this.showHeader === ShowHeaderMode.Always;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onError() {
|
||||||
|
this.isValidPath = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user