Skip to content

Commit 7a49802

Browse files
committed
Merge branch 'fix-embargoed-thumbnails_contribute-8.1' into fix-embargoed-thumbnails_contribute-9.0
2 parents b119111 + 12a3b4f commit 7a49802

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

src/app/item-page/media-viewer/media-viewer.component.html

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[showMessage]="false"
66
></ds-loading>
77
}
8-
@if (!isLoading) {
8+
@else {
99
<div class="media-viewer">
1010
@if (mediaList.length > 0) {
1111
<ng-container *ngVar="mediaOptions.video && ['audio', 'video'].includes(mediaList[0]?.format) as showVideo">
@@ -33,17 +33,9 @@
3333
</ng-container>
3434
</ng-container>
3535
} @else {
36-
@if (mediaOptions.image && mediaOptions.video) {
37-
<ds-media-viewer-image
38-
[image]="(thumbnailsRD$ | async)?.payload?.page[0]?._links.content.href || thumbnailPlaceholder"
39-
[preview]="false"
40-
></ds-media-viewer-image>
41-
}
42-
@if (!(mediaOptions.image && mediaOptions.video)) {
43-
<ds-thumbnail
44-
[thumbnail]="(thumbnailsRD$ | async)?.payload?.page[0]">
45-
</ds-thumbnail>
46-
}
36+
<ds-thumbnail
37+
[thumbnail]="(thumbnailsRD$ | async)?.payload?.page[0]">
38+
</ds-thumbnail>
4739
}
4840
</div>
4941
}

src/app/item-page/media-viewer/media-viewer.component.spec.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NO_ERRORS_SCHEMA } from '@angular/core';
1+
import { NO_ERRORS_SCHEMA, PLATFORM_ID } from '@angular/core';
22
import {
33
ComponentFixture,
44
TestBed,
@@ -29,10 +29,17 @@ import { ThemeService } from '../../shared/theme-support/theme.service';
2929
import { FileSizePipe } from '../../shared/utils/file-size-pipe';
3030
import { VarDirective } from '../../shared/utils/var.directive';
3131
import { MediaViewerComponent } from './media-viewer.component';
32+
import {
33+
AuthorizationDataService
34+
} from '../../core/data/feature-authorization/authorization-data.service';
35+
import { FileService } from '../../core/shared/file.service';
3236

3337
describe('MediaViewerComponent', () => {
3438
let comp: MediaViewerComponent;
3539
let fixture: ComponentFixture<MediaViewerComponent>;
40+
let authService;
41+
let authorizationService;
42+
let fileService;
3643

3744
const mockBitstream: Bitstream = Object.assign(new Bitstream(), {
3845
sizeBytes: 10201,
@@ -57,7 +64,7 @@ describe('MediaViewerComponent', () => {
5764
'dc.title': [
5865
{
5966
language: null,
60-
value: 'test_word.docx',
67+
value: 'test_image.jpg',
6168
},
6269
],
6370
},
@@ -75,6 +82,15 @@ describe('MediaViewerComponent', () => {
7582
);
7683

7784
beforeEach(waitForAsync(() => {
85+
authService = jasmine.createSpyObj('AuthService', {
86+
isAuthenticated: observableOf(true),
87+
});
88+
authorizationService = jasmine.createSpyObj('AuthorizationService', {
89+
isAuthorized: observableOf(true),
90+
});
91+
fileService = jasmine.createSpyObj('FileService', {
92+
retrieveFileDownloadLink: null,
93+
});
7894
return TestBed.configureTestingModule({
7995
imports: [
8096
TranslateModule.forRoot({
@@ -90,6 +106,10 @@ describe('MediaViewerComponent', () => {
90106
MetadataFieldWrapperComponent,
91107
],
92108
providers: [
109+
{ provide: AuthService, useValue: authService },
110+
{ provide: AuthorizationDataService, useValue: authorizationService },
111+
{ provide: FileService, useValue: fileService },
112+
{ provide: PLATFORM_ID, useValue: 'browser' },
93113
{ provide: BitstreamDataService, useValue: bitstreamDataService },
94114
{ provide: ThemeService, useValue: getMockThemeService() },
95115
{ provide: AuthService, useValue: new AuthServiceMock() },
@@ -153,9 +173,9 @@ describe('MediaViewerComponent', () => {
153173
expect(mediaItem.thumbnail).toBe(null);
154174
});
155175

156-
it('should display a default, thumbnail', () => {
176+
it('should display a default thumbnail', () => {
157177
const defaultThumbnail = fixture.debugElement.query(
158-
By.css('ds-media-viewer-image'),
178+
By.css('ds-thumbnail')
159179
);
160180
expect(defaultThumbnail.nativeElement).toBeDefined();
161181
});

0 commit comments

Comments
 (0)