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