[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

@@ -44,8 +44,8 @@
<mat-icon>navigate_before</mat-icon>
</button>
<img class="adf-viewer__mimeicon"
[alt]="mimeType"
[src]="mimeType | adfMimeTypeIcon"
[alt]="originalMimeType || mimeType"
[src]="(originalMimeType || mimeType) | adfMimeTypeIcon"
data-automation-id="adf-file-thumbnail">
<span class="adf-viewer__display-name"
id="adf-viewer-display-name">{{ fileName }}</span>

View File

@@ -115,6 +115,38 @@ describe('ViewerComponent', () => {
});
describe('originalMimeType', () => {
const getMimeTypeIconElement = () => fixture.nativeElement.querySelector('.adf-viewer__mimeicon');
it('should set alt attribute to originalMimeType when originalMimeType is provided', () => {
component.originalMimeType = 'image/png';
fixture.detectChanges();
const altAttribute: string = getMimeTypeIconElement().getAttribute('alt');
expect(altAttribute).toBe('image/png');
});
it('should set src attribute based on originalMimeType when originalMimeType is provided', () => {
component.originalMimeType = 'image';
fixture.detectChanges();
const srcAttribute: string = getMimeTypeIconElement().getAttribute('src');
expect(srcAttribute).toContain('image');
});
it('should set alt attribute to mimeType when originalMimeType is not provided', () => {
component.mimeType = 'application/pdf';
fixture.detectChanges();
const altAttribute: string = getMimeTypeIconElement().getAttribute('alt');
expect(altAttribute).toBe('application/pdf');
});
it('should set src attribute based on mimeType when originalMimeType is not provided', () => {
component.mimeType = 'image';
fixture.detectChanges();
const srcAttribute: string = getMimeTypeIconElement().getAttribute('src');
expect(srcAttribute).toContain('image');
});
});
describe('File Name Test', () => {
it('should fileName be set by urlFile input if the fileName is not provided as Input', () => {

View File

@@ -160,6 +160,10 @@ export class ViewerComponent<T> implements OnDestroy, OnInit, OnChanges {
@Input()
mimeType: string;
/** Overload originalMimeType*/
@Input()
originalMimeType: string;
/**
* Context object available for binding by the local sidebarRightTemplate with let declarations.
*/