mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge branch 'fix-embargoed-thumbnails_contribute-8.1' into fix-embargoed-thumbnails_contribute-9.0
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
[showMessage]="false"
|
||||
></ds-loading>
|
||||
}
|
||||
@if (!isLoading) {
|
||||
@else {
|
||||
<div class="media-viewer">
|
||||
@if (mediaList.length > 0) {
|
||||
<ng-container *ngVar="mediaOptions.video && ['audio', 'video'].includes(mediaList[0]?.format) as showVideo">
|
||||
@@ -33,17 +33,9 @@
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
} @else {
|
||||
@if (mediaOptions.image && mediaOptions.video) {
|
||||
<ds-media-viewer-image
|
||||
[image]="(thumbnailsRD$ | async)?.payload?.page[0]?._links.content.href || thumbnailPlaceholder"
|
||||
[preview]="false"
|
||||
></ds-media-viewer-image>
|
||||
}
|
||||
@if (!(mediaOptions.image && mediaOptions.video)) {
|
||||
<ds-thumbnail
|
||||
[thumbnail]="(thumbnailsRD$ | async)?.payload?.page[0]">
|
||||
</ds-thumbnail>
|
||||
}
|
||||
<ds-thumbnail
|
||||
[thumbnail]="(thumbnailsRD$ | async)?.payload?.page[0]">
|
||||
</ds-thumbnail>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { NO_ERRORS_SCHEMA, PLATFORM_ID } from '@angular/core';
|
||||
import {
|
||||
ComponentFixture,
|
||||
TestBed,
|
||||
@@ -29,10 +29,17 @@ import { ThemeService } from '../../shared/theme-support/theme.service';
|
||||
import { FileSizePipe } from '../../shared/utils/file-size-pipe';
|
||||
import { VarDirective } from '../../shared/utils/var.directive';
|
||||
import { MediaViewerComponent } from './media-viewer.component';
|
||||
import {
|
||||
AuthorizationDataService
|
||||
} from '../../core/data/feature-authorization/authorization-data.service';
|
||||
import { FileService } from '../../core/shared/file.service';
|
||||
|
||||
describe('MediaViewerComponent', () => {
|
||||
let comp: MediaViewerComponent;
|
||||
let fixture: ComponentFixture<MediaViewerComponent>;
|
||||
let authService;
|
||||
let authorizationService;
|
||||
let fileService;
|
||||
|
||||
const mockBitstream: Bitstream = Object.assign(new Bitstream(), {
|
||||
sizeBytes: 10201,
|
||||
@@ -57,7 +64,7 @@ describe('MediaViewerComponent', () => {
|
||||
'dc.title': [
|
||||
{
|
||||
language: null,
|
||||
value: 'test_word.docx',
|
||||
value: 'test_image.jpg',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -75,6 +82,15 @@ describe('MediaViewerComponent', () => {
|
||||
);
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
authService = jasmine.createSpyObj('AuthService', {
|
||||
isAuthenticated: observableOf(true),
|
||||
});
|
||||
authorizationService = jasmine.createSpyObj('AuthorizationService', {
|
||||
isAuthorized: observableOf(true),
|
||||
});
|
||||
fileService = jasmine.createSpyObj('FileService', {
|
||||
retrieveFileDownloadLink: null,
|
||||
});
|
||||
return TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot({
|
||||
@@ -90,6 +106,10 @@ describe('MediaViewerComponent', () => {
|
||||
MetadataFieldWrapperComponent,
|
||||
],
|
||||
providers: [
|
||||
{ provide: AuthService, useValue: authService },
|
||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||
{ provide: FileService, useValue: fileService },
|
||||
{ provide: PLATFORM_ID, useValue: 'browser' },
|
||||
{ provide: BitstreamDataService, useValue: bitstreamDataService },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||
{ provide: AuthService, useValue: new AuthServiceMock() },
|
||||
@@ -153,9 +173,9 @@ describe('MediaViewerComponent', () => {
|
||||
expect(mediaItem.thumbnail).toBe(null);
|
||||
});
|
||||
|
||||
it('should display a default, thumbnail', () => {
|
||||
it('should display a default thumbnail', () => {
|
||||
const defaultThumbnail = fixture.debugElement.query(
|
||||
By.css('ds-media-viewer-image'),
|
||||
By.css('ds-thumbnail')
|
||||
);
|
||||
expect(defaultThumbnail.nativeElement).toBeDefined();
|
||||
});
|
||||
|
Reference in New Issue
Block a user