Merge branch 'browse-by-features' of https://github.com/atmire/dspace-angular into browse-by-features

Conflicts:
	src/app/core/data/data.service.spec.ts
This commit is contained in:
Kristof De Langhe
2018-08-29 14:40:38 +02:00
2 changed files with 10 additions and 12 deletions

View File

@@ -10,8 +10,7 @@ import { Observable } from 'rxjs/Observable';
import { FindAllOptions } from './request.models'; import { FindAllOptions } from './request.models';
import { SortOptions, SortDirection } from '../cache/models/sort-options.model'; import { SortOptions, SortDirection } from '../cache/models/sort-options.model';
const LINK_NAME = 'test'; const endpoint = 'https://rest.api/core';
const ENDPOINT = 'https://rest.api/core';
// tslint:disable:max-classes-per-file // tslint:disable:max-classes-per-file
class NormalizedTestObject extends NormalizedObject { class NormalizedTestObject extends NormalizedObject {
@@ -30,9 +29,8 @@ class TestService extends DataService<NormalizedTestObject, any> {
} }
public getBrowseEndpoint(options: FindAllOptions): Observable<string> { public getBrowseEndpoint(options: FindAllOptions): Observable<string> {
return Observable.of(ENDPOINT); return Observable.of(endpoint);
} }
} }
describe('DataService', () => { describe('DataService', () => {
@@ -50,7 +48,7 @@ describe('DataService', () => {
requestService, requestService,
rdbService, rdbService,
store, store,
LINK_NAME, endpoint,
halService halService
); );
} }
@@ -63,14 +61,14 @@ describe('DataService', () => {
options = {}; options = {};
(service as any).getFindAllHref(options).subscribe((value) => { (service as any).getFindAllHref(options).subscribe((value) => {
expect(value).toBe(ENDPOINT); expect(value).toBe(endpoint);
} }
); );
}); });
it('should include page in href if currentPage provided in options', () => { it('should include page in href if currentPage provided in options', () => {
options = { currentPage: 2 }; options = { currentPage: 2 };
const expected = `${ENDPOINT}?page=${options.currentPage - 1}`; const expected = `${endpoint}?page=${options.currentPage - 1}`;
(service as any).getFindAllHref(options).subscribe((value) => { (service as any).getFindAllHref(options).subscribe((value) => {
expect(value).toBe(expected); expect(value).toBe(expected);
@@ -79,7 +77,7 @@ describe('DataService', () => {
it('should include size in href if elementsPerPage provided in options', () => { it('should include size in href if elementsPerPage provided in options', () => {
options = { elementsPerPage: 5 }; options = { elementsPerPage: 5 };
const expected = `${ENDPOINT}?size=${options.elementsPerPage}`; const expected = `${endpoint}?size=${options.elementsPerPage}`;
(service as any).getFindAllHref(options).subscribe((value) => { (service as any).getFindAllHref(options).subscribe((value) => {
expect(value).toBe(expected); expect(value).toBe(expected);
@@ -89,7 +87,7 @@ describe('DataService', () => {
it('should include sort href if SortOptions provided in options', () => { it('should include sort href if SortOptions provided in options', () => {
const sortOptions = new SortOptions('field1', SortDirection.ASC); const sortOptions = new SortOptions('field1', SortDirection.ASC);
options = { sort: sortOptions}; options = { sort: sortOptions};
const expected = `${ENDPOINT}?sort=${sortOptions.field},${sortOptions.direction}`; const expected = `${endpoint}?sort=${sortOptions.field},${sortOptions.direction}`;
(service as any).getFindAllHref(options).subscribe((value) => { (service as any).getFindAllHref(options).subscribe((value) => {
expect(value).toBe(expected); expect(value).toBe(expected);
@@ -98,7 +96,7 @@ describe('DataService', () => {
it('should include startsWith in href if startsWith provided in options', () => { it('should include startsWith in href if startsWith provided in options', () => {
options = { startsWith: 'ab' }; options = { startsWith: 'ab' };
const expected = `${ENDPOINT}?startsWith=${options.startsWith}`; const expected = `${endpoint}?startsWith=${options.startsWith}`;
(service as any).getFindAllHref(options).subscribe((value) => { (service as any).getFindAllHref(options).subscribe((value) => {
expect(value).toBe(expected); expect(value).toBe(expected);
@@ -113,7 +111,7 @@ describe('DataService', () => {
sort: sortOptions, sort: sortOptions,
startsWith: 'ab' startsWith: 'ab'
} }
const expected = `${ENDPOINT}?page=${options.currentPage - 1}&size=${options.elementsPerPage}` + const expected = `${endpoint}?page=${options.currentPage - 1}&size=${options.elementsPerPage}` +
`&sort=${sortOptions.field},${sortOptions.direction}&startsWith=${options.startsWith}`; `&sort=${sortOptions.field},${sortOptions.direction}&startsWith=${options.startsWith}`;
(service as any).getFindAllHref(options).subscribe((value) => { (service as any).getFindAllHref(options).subscribe((value) => {

View File

@@ -12,7 +12,7 @@
<span *ngFor="let authorMd of object.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">{{authorMd.value}} <span *ngFor="let authorMd of object.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">{{authorMd.value}}
<span *ngIf="!last">; </span> <span *ngIf="!last">; </span>
</span> </span>
<span *ngIf="object.findMetadata('dc.date.issued')" class="item-date">{{object.findMetadata("dc.date.issued")}}</span> <span *ngIf="hasValue(object.findMetadata('dc.date.issued'))" class="item-date">{{object.findMetadata("dc.date.issued")}}</span>
</p> </p>
</ds-truncatable-part> </ds-truncatable-part>