Skip to content

Commit

Permalink
[ACS-5600] modified the variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasa-Nataliya committed Nov 20, 2023
1 parent 9d44636 commit 0efc094
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[sidebarLeftTemplateContext]="sidebarLeftTemplateContext"
[fileName]="fileName"
[mimeType]="mimeType"
[mimeTypeForUnknown]="mimeTypeForUnknown"
[originalMimeType]="originalMimeType"
[urlFile]="urlFileContent"
[tracks]="tracks"
[readOnly]="readOnly"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,17 +476,17 @@ describe('AlfrescoViewerComponent', () => {
//
});

describe('mimeTypeForUnknown', () => {
describe('originalMimeType', () => {

it('should set mimeTypeForUnknown based on nodeData content', () => {
it('should set originalMimeType based on nodeData content', () => {
const nodeData = {
content: {
mimeType: 'application/pdf'
}
};

component.mimeTypeForUnknown = nodeData.content.mimeType;
expect(component.mimeTypeForUnknown).toEqual(nodeData.content.mimeType);
component.originalMimeType = nodeData.content.mimeType;
expect(component.originalMimeType).toEqual(nodeData.content.mimeType);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy {
urlFileContent: string;
fileName: string;
mimeType: string;
mimeTypeForUnknown: string;
originalMimeType: string;
nodeEntry: NodeEntry;
tracks: Track[] = [];
readOnly: boolean = true;
Expand Down Expand Up @@ -329,7 +329,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy {
if (nodeRendition) {
urlFileContent = nodeRendition.url;
mimeType = nodeRendition.mimeType;
this.mimeTypeForUnknown = nodeData?.content?.mimeType;
this.originalMimeType = nodeData?.content?.mimeType;
}
} else if (viewerType === 'media') {
this.tracks = await this.renditionService.generateMediaTracksRendition(this.nodeId);
Expand Down
4 changes: 2 additions & 2 deletions lib/core/src/lib/viewer/components/viewer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
<mat-icon>navigate_before</mat-icon>
</button>
<img class="adf-viewer__mimeicon"
[alt]="(mimeTypeForUnknown ? mimeTypeForUnknown : mimeType)"
[src]="(mimeTypeForUnknown ? mimeTypeForUnknown : mimeType) | adfMimeTypeIcon"
[alt]="(originalMimeType ? originalMimeType : mimeType)"
[src]="(originalMimeType ? originalMimeType : mimeType) | adfMimeTypeIcon"
data-automation-id="adf-file-thumbnail">
<span class="adf-viewer__display-name"
id="adf-viewer-display-name">{{ fileName }}</span>
Expand Down
14 changes: 7 additions & 7 deletions lib/core/src/lib/viewer/components/viewer.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('ViewerComponent', () => {

});

describe('mimeTypeForUnknown', () => {
describe('originalMimeType', () => {

it('should set mimeType input correctly', () => {
const mimeTypeValue = 'image/png';
Expand All @@ -124,18 +124,18 @@ describe('ViewerComponent', () => {
expect(component.mimeType).toEqual(mimeTypeValue);
});

it('should set mimeTypeForUnknown input correctly', () => {
const mimeTypeForUnknownValue = 'application/msWord';
component.mimeTypeForUnknown = mimeTypeForUnknownValue;
it('should set originalMimeType input correctly', () => {
const originalMimeTypeValue = 'application/msWord';
component.originalMimeType = originalMimeTypeValue;

expect(component.mimeTypeForUnknown).toEqual(mimeTypeForUnknownValue);
expect(component.originalMimeType).toEqual(originalMimeTypeValue);
});

it('should set alt attribute correctly based on mimeTypeForUnknown', () => {
it('should set alt attribute correctly based on originalMimeType', () => {
const mimeTypeValue = 'image/jpeg';
const altAttributeValue = 'Alt Text';
component.mimeType = mimeTypeValue;
component.mimeTypeForUnknown = altAttributeValue;
component.originalMimeType = altAttributeValue;
fixture.detectChanges();
const altAttribute = fixture.nativeElement.querySelector('.adf-viewer__mimeicon').getAttribute('alt');

Expand Down
4 changes: 2 additions & 2 deletions lib/core/src/lib/viewer/components/viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ export class ViewerComponent<T> implements OnDestroy, OnInit, OnChanges {
@Input()
mimeType: string;

/** Overload mimeTypeForUnknown*/
/** Overload originalMimeType*/
@Input()
mimeTypeForUnknown: string;
originalMimeType: string;

/**
* Context object available for binding by the local sidebarRightTemplate with let declarations.
Expand Down

0 comments on commit 0efc094

Please sign in to comment.