mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3324] Preview - unshared file breaks preview (#3580)
This commit is contained in:
committed by
Eugenio Romano
parent
50b6fb978b
commit
ee8151d50d
@@ -592,6 +592,41 @@ describe('ViewerComponent', () => {
|
||||
}));
|
||||
});
|
||||
|
||||
describe('error handling', () => {
|
||||
|
||||
it('should show unknown view when node file not found', async(() => {
|
||||
spyOn(alfrescoApiService.getInstance().nodes, 'getNodeInfo')
|
||||
.and.returnValue(Promise.reject({}));
|
||||
|
||||
component.nodeId = 'the-node-id-of-the-file-to-preview';
|
||||
component.urlFile = null;
|
||||
component.mimeType = null;
|
||||
|
||||
component.ngOnChanges(null);
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('adf-viewer-unknown-format')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should show unknown view when sharedLink file not found', async(() => {
|
||||
spyOn(alfrescoApiService.getInstance().core.sharedlinksApi, 'getSharedLink')
|
||||
.and.returnValue(Promise.reject({}));
|
||||
|
||||
component.sharedLinkId = 'the-Shared-Link-id';
|
||||
component.urlFile = null;
|
||||
component.mimeType = null;
|
||||
|
||||
component.ngOnChanges(null);
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('adf-viewer-unknown-format')).not.toBeNull();
|
||||
});
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
describe('MimeType handling', () => {
|
||||
|
||||
it('should display a PDF file identified by mimetype when the filename has no extension', async(() => {
|
||||
|
@@ -298,10 +298,15 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
);
|
||||
} else if (this.sharedLinkId) {
|
||||
|
||||
this.apiService.sharedLinksApi.getSharedLink(this.sharedLinkId).then(details => {
|
||||
this.setUpSharedLinkFile(details);
|
||||
this.isLoading = false;
|
||||
});
|
||||
this.apiService.sharedLinksApi.getSharedLink(this.sharedLinkId).then(
|
||||
details => {
|
||||
this.setUpSharedLinkFile(details);
|
||||
this.isLoading = false;
|
||||
},
|
||||
() => {
|
||||
this.isLoading = false;
|
||||
this.logService.error('This sharedLink does not exist');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user