mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
fix no content node display (#3351)
This commit is contained in:
committed by
Denys Vuika
parent
8fae47639c
commit
e8cf6f6f38
@@ -41,7 +41,8 @@ import { AlfrescoApiServiceMock } from '../../mock/alfresco-api.service.mock';
|
|||||||
</adf-viewer>
|
</adf-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomToolbarComponent {}
|
class ViewerWithCustomToolbarComponent {
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer-container-toolbar-actions',
|
selector: 'adf-viewer-container-toolbar-actions',
|
||||||
@@ -55,7 +56,8 @@ class ViewerWithCustomToolbarComponent {}
|
|||||||
</adf-viewer>
|
</adf-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomToolbarActionsComponent {}
|
class ViewerWithCustomToolbarActionsComponent {
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer-container-sidebar',
|
selector: 'adf-viewer-container-sidebar',
|
||||||
@@ -67,7 +69,8 @@ class ViewerWithCustomToolbarActionsComponent {}
|
|||||||
</adf-viewer>
|
</adf-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomSidebarComponent {}
|
class ViewerWithCustomSidebarComponent {
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer-container-open-with',
|
selector: 'adf-viewer-container-open-with',
|
||||||
@@ -90,7 +93,8 @@ class ViewerWithCustomSidebarComponent {}
|
|||||||
</adf-viewer>
|
</adf-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomOpenWithComponent {}
|
class ViewerWithCustomOpenWithComponent {
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer-container-more-actions',
|
selector: 'adf-viewer-container-more-actions',
|
||||||
@@ -113,7 +117,8 @@ class ViewerWithCustomOpenWithComponent {}
|
|||||||
</adf-viewer>
|
</adf-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomMoreActionsComponent {}
|
class ViewerWithCustomMoreActionsComponent {
|
||||||
|
}
|
||||||
|
|
||||||
describe('ViewerComponent', () => {
|
describe('ViewerComponent', () => {
|
||||||
|
|
||||||
@@ -135,11 +140,13 @@ describe('ViewerComponent', () => {
|
|||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||||
{provide: RenditionsService, useValue: {
|
{
|
||||||
|
provide: RenditionsService, useValue: {
|
||||||
getRendition: () => {
|
getRendition: () => {
|
||||||
return Observable.throw('throwed');
|
return Observable.throw('throwed');
|
||||||
}
|
}
|
||||||
}},
|
}
|
||||||
|
},
|
||||||
RenderingQueueServices,
|
RenderingQueueServices,
|
||||||
{ provide: Location, useClass: SpyLocation }
|
{ provide: Location, useClass: SpyLocation }
|
||||||
]
|
]
|
||||||
@@ -671,6 +678,28 @@ describe('ViewerComponent', () => {
|
|||||||
expect(element.querySelector('adf-media-player')).not.toBeNull();
|
expect(element.querySelector('adf-media-player')).not.toBeNull();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should node without content show unkonwn', async(() => {
|
||||||
|
const displayName = 'the-name';
|
||||||
|
const nodeDetails = { name: displayName, id: '12' };
|
||||||
|
const contentUrl = '/content/url/path';
|
||||||
|
const alfrescoApiInstanceMock = {
|
||||||
|
nodes: { getNodeInfo: () => Promise.resolve(nodeDetails) },
|
||||||
|
content: { getContentUrl: () => contentUrl }
|
||||||
|
};
|
||||||
|
|
||||||
|
component.fileNodeId = '12';
|
||||||
|
component.urlFile = null;
|
||||||
|
component.displayName = null;
|
||||||
|
spyOn(alfrescoApiService, 'getInstance').and.returnValue(alfrescoApiInstanceMock);
|
||||||
|
|
||||||
|
component.ngOnChanges(null);
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(element.querySelector('adf-viewer-unknown-format')).toBeDefined();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Events', () => {
|
describe('Events', () => {
|
||||||
|
@@ -334,7 +334,10 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setUpNodeFile(data: MinimalNodeEntryEntity) {
|
private setUpNodeFile(data: MinimalNodeEntryEntity) {
|
||||||
|
if (data.content) {
|
||||||
this.mimeType = data.content.mimeType;
|
this.mimeType = data.content.mimeType;
|
||||||
|
}
|
||||||
|
|
||||||
this.displayName = data.name;
|
this.displayName = data.name;
|
||||||
|
|
||||||
this.urlFileContent = this.apiService.contentApi.getContentUrl(data.id);
|
this.urlFileContent = this.apiService.contentApi.getContentUrl(data.id);
|
||||||
|
Reference in New Issue
Block a user