diff --git a/e2e/simple-item-page/simple-item-page.e2e-spec.ts b/e2e/simple-item-page/simple-item-page.e2e-spec.ts index 9fdcb1bec2..4920efc858 100644 --- a/e2e/simple-item-page/simple-item-page.e2e-spec.ts +++ b/e2e/simple-item-page/simple-item-page.e2e-spec.ts @@ -1,6 +1,6 @@ import { ProtractorPage } from './simple-item-page.po'; -describe('protractor Simple Item Page', function() { +describe('protractor Simple Item Page', function () { let page: ProtractorPage; beforeEach(() => { @@ -9,11 +9,19 @@ describe('protractor Simple Item Page', function() { }); it('should contain element ds-thumbnail"', () => { - expect(page.elementTagExists("ds-thumbnail")).toEqual(true); + expect(page.elementSelectorExists("ds-thumbnail img")).toEqual(true); }); - it('should contain element h1.item-page-title-field"', () => { - expect(page.elementSelectorExists("h1.selector")).toEqual(true); + it('should contain element an h2 title field"', () => { + expect(page.elementSelectorExists("h2.item-page-title-field")).toEqual(true); + }); + + it('should contain element link to its collections"', () => { + expect(page.elementTagExists("ds-item-page-collections")).toEqual(true); + }); + + it('should contain a file section"', () => { + expect(page.elementTagExists("ds-item-page-file-section")).toEqual(true); }); }); diff --git a/e2e/simple-item-page/simple-item-page.po.ts b/e2e/simple-item-page/simple-item-page.po.ts index f0b36dd6eb..d085049d33 100644 --- a/e2e/simple-item-page/simple-item-page.po.ts +++ b/e2e/simple-item-page/simple-item-page.po.ts @@ -1,7 +1,7 @@ import { browser, element, by } from 'protractor'; export class ProtractorPage { - ITEMPAGE : string = "/items/8766"; + ITEMPAGE : string = "/items/8871"; navigateToSimpleItemPage() { return browser.get(this.ITEMPAGE); diff --git a/src/app/item-page/collections/collections.component.ts b/src/app/item-page/collections/collections.component.ts index 742ac247a1..10afd39ae1 100644 --- a/src/app/item-page/collections/collections.component.ts +++ b/src/app/item-page/collections/collections.component.ts @@ -3,6 +3,11 @@ import { Collection } from "../../core/shared/collection.model"; import { Observable } from "rxjs"; import { Item } from "../../core/shared/item.model"; +/** + * This component renders the parent collections section of the item + * inside a 'ds-metadata-field-wrapper' component. + */ + @Component({ selector: 'ds-item-page-collections', templateUrl: './collections.component.html' diff --git a/src/app/item-page/file-section/file-section.component.ts b/src/app/item-page/file-section/file-section.component.ts index 08b01b8ea1..fe0defb105 100644 --- a/src/app/item-page/file-section/file-section.component.ts +++ b/src/app/item-page/file-section/file-section.component.ts @@ -3,6 +3,11 @@ import { Bitstream } from "../../core/shared/bitstream.model"; import { Item } from "../../core/shared/item.model"; import { Observable } from "rxjs"; +/** + * This component renders the file section of the item + * inside a 'ds-metadata-field-wrapper' component. + */ + @Component({ selector: 'ds-item-page-file-section', templateUrl: './file-section.component.html' diff --git a/src/app/item-page/metadata-field-wrapper/metadata-field-wrapper.component.ts b/src/app/item-page/metadata-field-wrapper/metadata-field-wrapper.component.ts index caae4bd5f1..2b40f33b5d 100644 --- a/src/app/item-page/metadata-field-wrapper/metadata-field-wrapper.component.ts +++ b/src/app/item-page/metadata-field-wrapper/metadata-field-wrapper.component.ts @@ -1,5 +1,10 @@ import { Component, Input } from '@angular/core'; +/** + * This component renders any content inside this wrapper. + * The wrapper prints a label before the content (if available) + */ + @Component({ selector: 'ds-metadata-field-wrapper', styleUrls: ['./metadata-field-wrapper.component.css'], diff --git a/src/app/item-page/metadata-uri-values/metadata-uri-values.component.ts b/src/app/item-page/metadata-uri-values/metadata-uri-values.component.ts index fa4a9ebfc5..398e6ed278 100644 --- a/src/app/item-page/metadata-uri-values/metadata-uri-values.component.ts +++ b/src/app/item-page/metadata-uri-values/metadata-uri-values.component.ts @@ -1,6 +1,14 @@ import { Component, Input } from '@angular/core'; import { MetadataValuesComponent } from "../metadata-values/metadata-values.component"; +/** + * This component renders the configured 'values' into the ds-metadata-field-wrapper component as a link. + * It puts the given 'separator' between each two values + * and creates an 'a' tag for each value, + * using the 'linktext' as it's value (if it exists) + * and using the values as the 'href' attribute (and as value of the tag when no 'linktext' is defined) + */ + @Component({ selector: 'ds-metadata-uri-values', styleUrls: ['./metadata-uri-values.component.css'], diff --git a/src/app/item-page/metadata-values/metadata-values.component.ts b/src/app/item-page/metadata-values/metadata-values.component.ts index 6ac07ad914..26e18adffd 100644 --- a/src/app/item-page/metadata-values/metadata-values.component.ts +++ b/src/app/item-page/metadata-values/metadata-values.component.ts @@ -1,5 +1,10 @@ import { Component, Input } from '@angular/core'; +/** + * This component renders the configured 'values' into the ds-metadata-field-wrapper component. + * It puts the given 'separator' between each two values. + */ + @Component({ selector: 'ds-metadata-values', styleUrls: ['./metadata-values.component.css'], diff --git a/src/app/shared/utils/file-size-pipe.ts b/src/app/shared/utils/file-size-pipe.ts index fbd3ae081c..e00092271e 100644 --- a/src/app/shared/utils/file-size-pipe.ts +++ b/src/app/shared/utils/file-size-pipe.ts @@ -9,6 +9,7 @@ import { Pipe, PipeTransform } from '@angular/core'; * {{ 1024 | fileSize}} * formats to: 1 KB */ + @Pipe({name: 'dsFileSize'}) export class FileSizePipe implements PipeTransform { diff --git a/src/app/shared/utils/safe-url-pipe.ts b/src/app/shared/utils/safe-url-pipe.ts index e05e58764b..a32aa18ab8 100644 --- a/src/app/shared/utils/safe-url-pipe.ts +++ b/src/app/shared/utils/safe-url-pipe.ts @@ -1,6 +1,11 @@ import { Pipe, PipeTransform } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; +/** + * This pipe explicitly escapes the sanitization of a URL, + * only use this when you are sure the URL is indeed safe + */ + @Pipe({name: 'dsSafeUrl'}) export class SafeUrlPipe implements PipeTransform { constructor(private domSanitizer: DomSanitizer) {}