[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:
Yasa-Nataliya
2023-11-30 14:36:34 +05:30
committed by GitHub
parent 8a184efc6c
commit 065829ef01
7 changed files with 79 additions and 2 deletions

View File

@@ -18,6 +18,7 @@
[sidebarLeftTemplateContext]="sidebarLeftTemplateContext"
[fileName]="fileName"
[mimeType]="mimeType"
[originalMimeType]="originalMimeType"
[urlFile]="urlFileContent"
[tracks]="tracks"
[readOnly]="readOnly"

View File

@@ -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;

View File

@@ -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);