mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
repair tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<ds-metadata-field-wrapper [label]="label | translate">
|
<ds-metadata-field-wrapper [label]="label | translate">
|
||||||
<ng-container *ngFor="let mdValue of mdValues; let last=last;">
|
<ng-container *ngFor="let mdValue of mdValues; let last=last;">
|
||||||
<ng-container *ngTemplateOutlet="(env.markdown.enabled && this.enableMarkdown ? markdown : simple); context: {value: mdValue.value, classes: 'dont-break-out preserve-line-breaks'}">
|
<ng-container *ngTemplateOutlet="(renderMarkdown ? markdown : simple); context: {value: mdValue.value, classes: 'dont-break-out preserve-line-breaks'}">
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<span class="separator" *ngIf="!last" [innerHTML]="separator"></span>
|
<span class="separator" *ngIf="!last" [innerHTML]="separator"></span>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { MetadataValue } from '../../../core/shared/metadata.models';
|
import { MetadataValue } from '../../../core/shared/metadata.models';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ import { environment } from '../../../../environments/environment';
|
|||||||
styleUrls: ['./metadata-values.component.scss'],
|
styleUrls: ['./metadata-values.component.scss'],
|
||||||
templateUrl: './metadata-values.component.html'
|
templateUrl: './metadata-values.component.html'
|
||||||
})
|
})
|
||||||
export class MetadataValuesComponent {
|
export class MetadataValuesComponent implements OnChanges {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The metadata values to display
|
* The metadata values to display
|
||||||
@@ -35,5 +35,12 @@ export class MetadataValuesComponent {
|
|||||||
*/
|
*/
|
||||||
@Input() enableMarkdown = false;
|
@Input() enableMarkdown = false;
|
||||||
|
|
||||||
env = environment;
|
/**
|
||||||
|
* This variable will be true if both {@link environment.markdown.enabled} and {@link enableMarkdown} are true.
|
||||||
|
*/
|
||||||
|
renderMarkdown;
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
|
this.renderMarkdown = !!environment.markdown.enabled && this.enableMarkdown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,7 @@ import { createPaginatedList } from '../../../../shared/testing/utils.test';
|
|||||||
import { environment } from '../../../../../environments/environment';
|
import { environment } from '../../../../../environments/environment';
|
||||||
import { MarkdownPipe } from '../../../../shared/utils/markdown.pipe';
|
import { MarkdownPipe } from '../../../../shared/utils/markdown.pipe';
|
||||||
import { SharedModule } from '../../../../shared/shared.module';
|
import { SharedModule } from '../../../../shared/shared.module';
|
||||||
|
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||||
|
|
||||||
let comp: ItemPageFieldComponent;
|
let comp: ItemPageFieldComponent;
|
||||||
let fixture: ComponentFixture<ItemPageFieldComponent>;
|
let fixture: ComponentFixture<ItemPageFieldComponent>;
|
||||||
@@ -33,6 +34,9 @@ describe('ItemPageFieldComponent', () => {
|
|||||||
}),
|
}),
|
||||||
SharedModule,
|
SharedModule,
|
||||||
],
|
],
|
||||||
|
providers: [
|
||||||
|
{ provide: APP_CONFIG, useValue: Object.assign({}, environment) },
|
||||||
|
],
|
||||||
declarations: [ItemPageFieldComponent, MetadataValuesComponent],
|
declarations: [ItemPageFieldComponent, MetadataValuesComponent],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).overrideComponent(ItemPageFieldComponent, {
|
}).overrideComponent(ItemPageFieldComponent, {
|
||||||
@@ -57,7 +61,7 @@ describe('ItemPageFieldComponent', () => {
|
|||||||
describe('when markdown is disabled in the environment config', () => {
|
describe('when markdown is disabled in the environment config', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
environment.markdown.enabled = false;
|
TestBed.inject(APP_CONFIG).markdown.enabled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('and markdown is disabled in this component', () => {
|
describe('and markdown is disabled in this component', () => {
|
||||||
@@ -88,7 +92,7 @@ describe('ItemPageFieldComponent', () => {
|
|||||||
describe('when markdown is enabled in the environment config', () => {
|
describe('when markdown is enabled in the environment config', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
environment.markdown.enabled = true;
|
TestBed.inject(APP_CONFIG).markdown.enabled = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('and markdown is disabled in this component', () => {
|
describe('and markdown is disabled in this component', () => {
|
||||||
|
Reference in New Issue
Block a user