mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
113124: Allow opening ds-metadata-uri-values links in a new window
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<ds-metadata-field-wrapper [label]="label | translate">
|
<ds-metadata-field-wrapper [label]="label | translate">
|
||||||
<a class="dont-break-out" *ngFor="let mdValue of mdValues; let last=last;" [href]="mdValue.value">
|
<a class="dont-break-out" *ngFor="let mdValue of mdValues; let last=last;" [href]="mdValue.value" [target]="linkTarget">
|
||||||
{{ linktext || mdValue.value }}<span *ngIf="!last" [innerHTML]="separator"></span>
|
{{ linktext || mdValue.value }}<span *ngIf="!last" [innerHTML]="separator"></span>
|
||||||
</a>
|
</a>
|
||||||
</ds-metadata-field-wrapper>
|
</ds-metadata-field-wrapper>
|
||||||
|
@@ -73,6 +73,13 @@ describe('MetadataUriValuesComponent', () => {
|
|||||||
expect(separators.length).toBe(mockMetadata.length - 1);
|
expect(separators.length).toBe(mockMetadata.length - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should contain the correct target attribute for metadata links', () => {
|
||||||
|
const links = fixture.debugElement.queryAll(By.css('a'));
|
||||||
|
for (const link of links) {
|
||||||
|
expect(link.nativeElement.getAttribute('target')).toBe('_blank');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
describe('when linktext is defined', () => {
|
describe('when linktext is defined', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -37,4 +37,10 @@ export class MetadataUriValuesComponent extends MetadataValuesComponent {
|
|||||||
* The label for this iteration of metadata values
|
* The label for this iteration of metadata values
|
||||||
*/
|
*/
|
||||||
@Input() label: string;
|
@Input() label: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The target attribute for the metadata links.
|
||||||
|
* Defaults to '_blank' to open links in a new window/tab.
|
||||||
|
*/
|
||||||
|
@Input() linkTarget = '_blank';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user