mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-5600] AlfrescoViewerComponent shows the original mimetype (#9095)
* [ACS-5600]Changes for bug * [ACS-5600]Changes for bug fixes * [5600]fixed the space * [ACS-5600] modified the variable name * [ACS-5600]Implemented the review comments * [ACS-5600]modified the test cases * [ACS-5600] modified the test cases * [ACS-5600]modified the changes * [ci:force]
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
[sidebarLeftTemplateContext]="sidebarLeftTemplateContext"
|
||||
[fileName]="fileName"
|
||||
[mimeType]="mimeType"
|
||||
[originalMimeType]="originalMimeType"
|
||||
[urlFile]="urlFileContent"
|
||||
[tracks]="tracks"
|
||||
[readOnly]="readOnly"
|
||||
|
@@ -476,6 +476,42 @@ describe('AlfrescoViewerComponent', () => {
|
||||
//
|
||||
});
|
||||
|
||||
describe('originalMimeType', () => {
|
||||
it('should set originalMimeType based on nodeData content', async () => {
|
||||
const defaultNode: Node = {
|
||||
id: 'mock-id',
|
||||
name: 'Mock Node',
|
||||
nodeType: 'cm:content',
|
||||
isFolder: false,
|
||||
isFile: true,
|
||||
modifiedAt: new Date(),
|
||||
modifiedByUser: { id: 'user123', displayName: 'John Doe' },
|
||||
createdAt: new Date(),
|
||||
createdByUser: { id: 'user456', displayName: 'Jane Doe' },
|
||||
properties: { 'cm:versionLabel': 'mock-version-label' }
|
||||
};
|
||||
component.nodeEntry = { entry: defaultNode };
|
||||
component.nodeId = '123';
|
||||
spyOn(renditionService, 'getNodeRendition').and.returnValue(
|
||||
Promise.resolve({
|
||||
url: '',
|
||||
mimeType: ''
|
||||
})
|
||||
);
|
||||
|
||||
fixture.detectChanges();
|
||||
nodesApiService.nodeUpdated.next({
|
||||
id: '123',
|
||||
name: 'file2',
|
||||
content: {
|
||||
mimeType: 'application/msWord'
|
||||
}
|
||||
} as any);
|
||||
await fixture.whenStable();
|
||||
expect(component.originalMimeType).toEqual('application/msWord');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Toolbar', () => {
|
||||
it('should show only next file button', async () => {
|
||||
component.allowNavigate = true;
|
||||
|
@@ -192,6 +192,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
urlFileContent: string;
|
||||
fileName: string;
|
||||
mimeType: string;
|
||||
originalMimeType: string;
|
||||
nodeEntry: NodeEntry;
|
||||
tracks: Track[] = [];
|
||||
readOnly: boolean = true;
|
||||
@@ -328,6 +329,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
if (nodeRendition) {
|
||||
urlFileContent = nodeRendition.url;
|
||||
mimeType = nodeRendition.mimeType;
|
||||
this.originalMimeType = nodeData?.content?.mimeType;
|
||||
}
|
||||
} else if (viewerType === 'media') {
|
||||
this.tracks = await this.renditionService.generateMediaTracksRendition(this.nodeId);
|
||||
|
Reference in New Issue
Block a user