mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge remote-tracking branch 'origin/main' into CST-6110
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||||
@@ -17,7 +17,7 @@ import { RemoteData } from '../../../../core/data/remote-data';
|
|||||||
import { Bitstream } from '../../../../core/shared/bitstream.model';
|
import { Bitstream } from '../../../../core/shared/bitstream.model';
|
||||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { MetadataMap } from '../../../../core/shared/metadata.models';
|
import { MetadataMap } from '../../../../core/shared/metadata.models';
|
||||||
import { UUIDService } from '../../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../../core/shared/uuid.service';
|
||||||
import { TranslateLoaderMock } from '../../../../shared/mocks/translate-loader.mock';
|
import { TranslateLoaderMock } from '../../../../shared/mocks/translate-loader.mock';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
@@ -26,9 +26,7 @@ import { TruncatableService } from '../../../../shared/truncatable/truncatable.s
|
|||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { GenericItemPageFieldComponent } from '../../field-components/specific-field/generic/generic-item-page-field.component';
|
import { GenericItemPageFieldComponent } from '../../field-components/specific-field/generic/generic-item-page-field.component';
|
||||||
import {
|
import {
|
||||||
createRelationshipsObservable,
|
createRelationshipsObservable, getIIIFEnabled, getIIIFSearchEnabled, mockRouteService
|
||||||
iiifEnabled,
|
|
||||||
iiifSearchEnabled, mockRouteService
|
|
||||||
} from '../shared/item.component.spec';
|
} from '../shared/item.component.spec';
|
||||||
import { PublicationComponent } from './publication.component';
|
import { PublicationComponent } from './publication.component';
|
||||||
import { createPaginatedList } from '../../../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../../../shared/testing/utils.test';
|
||||||
@@ -39,15 +37,6 @@ import { RouterTestingModule } from '@angular/router/testing';
|
|||||||
import { WorkspaceitemDataService } from '../../../../core/submission/workspaceitem-data.service';
|
import { WorkspaceitemDataService } from '../../../../core/submission/workspaceitem-data.service';
|
||||||
import { SearchService } from '../../../../core/shared/search/search.service';
|
import { SearchService } from '../../../../core/shared/search/search.service';
|
||||||
|
|
||||||
const iiifEnabledMap: MetadataMap = {
|
|
||||||
'dspace.iiif.enabled': [iiifEnabled],
|
|
||||||
};
|
|
||||||
|
|
||||||
const iiifEnabledWithSearchMap: MetadataMap = {
|
|
||||||
'dspace.iiif.enabled': [iiifEnabled],
|
|
||||||
'iiif.search.enabled': [iiifSearchEnabled],
|
|
||||||
};
|
|
||||||
|
|
||||||
const noMetadata = new MetadataMap();
|
const noMetadata = new MetadataMap();
|
||||||
|
|
||||||
function getItem(metadata: MetadataMap) {
|
function getItem(metadata: MetadataMap) {
|
||||||
@@ -103,12 +92,13 @@ describe('PublicationComponent', () => {
|
|||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).overrideComponent(PublicationComponent, {
|
}).overrideComponent(PublicationComponent, {
|
||||||
set: { changeDetection: ChangeDetectionStrategy.Default }
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
}).compileComponents();
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('default view', () => {
|
describe('default view', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.compileComponents();
|
||||||
fixture = TestBed.createComponent(PublicationComponent);
|
fixture = TestBed.createComponent(PublicationComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
comp.object = getItem(noMetadata);
|
comp.object = getItem(noMetadata);
|
||||||
@@ -149,6 +139,42 @@ describe('PublicationComponent', () => {
|
|||||||
describe('with IIIF viewer', () => {
|
describe('with IIIF viewer', () => {
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
const iiifEnabledMap: MetadataMap = {
|
||||||
|
'dspace.iiif.enabled': [getIIIFEnabled(true)],
|
||||||
|
'iiif.search.enabled': [getIIIFSearchEnabled(false)],
|
||||||
|
};
|
||||||
|
TestBed.compileComponents();
|
||||||
|
fixture = TestBed.createComponent(PublicationComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
comp.object = getItem(iiifEnabledMap);
|
||||||
|
fixture.detectChanges();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should contain an iiif viewer component', () => {
|
||||||
|
const fields = fixture.debugElement.queryAll(By.css('ds-mirador-viewer'));
|
||||||
|
expect(fields.length).toBeGreaterThanOrEqual(1);
|
||||||
|
});
|
||||||
|
it('should not retrieve the query term for previous route', fakeAsync((): void => {
|
||||||
|
//tick(10)
|
||||||
|
expect(comp.iiifQuery$).toBeFalsy();
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('with IIIF viewer and search', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
const localMockRouteService = {
|
||||||
|
getPreviousUrl(): Observable<string> {
|
||||||
|
return of('/search?query=test%20query&fakeParam=true');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const iiifEnabledMap: MetadataMap = {
|
||||||
|
'dspace.iiif.enabled': [getIIIFEnabled(true)],
|
||||||
|
'iiif.search.enabled': [getIIIFSearchEnabled(true)],
|
||||||
|
};
|
||||||
|
TestBed.overrideProvider(RouteService, {useValue: localMockRouteService});
|
||||||
|
TestBed.compileComponents();
|
||||||
fixture = TestBed.createComponent(PublicationComponent);
|
fixture = TestBed.createComponent(PublicationComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
comp.object = getItem(iiifEnabledMap);
|
comp.object = getItem(iiifEnabledMap);
|
||||||
@@ -160,15 +186,29 @@ describe('PublicationComponent', () => {
|
|||||||
expect(fields.length).toBeGreaterThanOrEqual(1);
|
expect(fields.length).toBeGreaterThanOrEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should retrieve the query term for previous route', fakeAsync((): void => {
|
||||||
|
expect(comp.iiifQuery$.subscribe(result => expect(result).toEqual('test query')));
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('with IIIF viewer and search', () => {
|
describe('with IIIF viewer and search but no previous search query', () => {
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
mockRouteService.getPreviousUrl.and.returnValue(of(['/search?q=bird&motivation=painting','/item']));
|
const localMockRouteService = {
|
||||||
|
getPreviousUrl(): Observable<string> {
|
||||||
|
return of('/item');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const iiifEnabledMap: MetadataMap = {
|
||||||
|
'dspace.iiif.enabled': [getIIIFEnabled(true)],
|
||||||
|
'iiif.search.enabled': [getIIIFSearchEnabled(true)],
|
||||||
|
};
|
||||||
|
TestBed.overrideProvider(RouteService, {useValue: localMockRouteService});
|
||||||
|
TestBed.compileComponents();
|
||||||
fixture = TestBed.createComponent(PublicationComponent);
|
fixture = TestBed.createComponent(PublicationComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
comp.object = getItem(iiifEnabledWithSearchMap);
|
comp.object = getItem(iiifEnabledMap);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -177,11 +217,12 @@ describe('PublicationComponent', () => {
|
|||||||
expect(fields.length).toBeGreaterThanOrEqual(1);
|
expect(fields.length).toBeGreaterThanOrEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call the RouteService getHistory method', () => {
|
it('should not retrieve the query term for previous route', fakeAsync( () => {
|
||||||
expect(mockRouteService.getPreviousUrl).toHaveBeenCalled();
|
let emitted;
|
||||||
});
|
comp.iiifQuery$.subscribe(result => emitted = result);
|
||||||
|
tick(10);
|
||||||
|
expect(emitted).toBeUndefined();
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { filter, map } from 'rxjs/operators';
|
import { filter, map, take } from 'rxjs/operators';
|
||||||
import { RouteService } from '../../../../core/services/route.service';
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
|
import { DefaultUrlSerializer, UrlTree } from '@angular/router';
|
||||||
|
|
||||||
export const isIiifEnabled = (item: Item) => {
|
export const isIiifEnabled = (item: Item) => {
|
||||||
return !!item.firstMetadataValue('dspace.iiif.enabled');
|
return !!item.firstMetadataValue('dspace.iiif.enabled');
|
||||||
@@ -21,15 +22,15 @@ export const isIiifSearchEnabled = (item: Item) => {
|
|||||||
* @param routeService
|
* @param routeService
|
||||||
*/
|
*/
|
||||||
export const getDSpaceQuery = (item: Item, routeService: RouteService): Observable<string> => {
|
export const getDSpaceQuery = (item: Item, routeService: RouteService): Observable<string> => {
|
||||||
|
|
||||||
return routeService.getPreviousUrl().pipe(
|
return routeService.getPreviousUrl().pipe(
|
||||||
filter(r => {
|
filter(r => {
|
||||||
return r.includes('/search');
|
return r.includes('/search');
|
||||||
}),
|
}),
|
||||||
map(r => {
|
map((r: string) => {
|
||||||
const arr = r.split('&');
|
const url: UrlTree = new DefaultUrlSerializer().parse(r);
|
||||||
const q = arr[1];
|
return url.queryParamMap.get('query');
|
||||||
const v = q.split('=');
|
}),
|
||||||
return v[1];
|
take(1)
|
||||||
})
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -40,21 +40,25 @@ import { RouterTestingModule } from '@angular/router/testing';
|
|||||||
import { AuthorizationDataService } from '../../../../core/data/feature-authorization/authorization-data.service';
|
import { AuthorizationDataService } from '../../../../core/data/feature-authorization/authorization-data.service';
|
||||||
import { ResearcherProfileService } from '../../../../core/profile/researcher-profile.service';
|
import { ResearcherProfileService } from '../../../../core/profile/researcher-profile.service';
|
||||||
|
|
||||||
export const iiifEnabled = Object.assign(new MetadataValue(),{
|
export function getIIIFSearchEnabled(enabled: boolean): MetadataValue {
|
||||||
'value': 'true',
|
return Object.assign(new MetadataValue(), {
|
||||||
'language': null,
|
'value': enabled,
|
||||||
'authority': null,
|
'language': null,
|
||||||
'confidence': -1,
|
'authority': null,
|
||||||
'place': 0
|
'confidence': -1,
|
||||||
});
|
'place': 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export const iiifSearchEnabled = Object.assign(new MetadataValue(), {
|
export function getIIIFEnabled(enabled: boolean): MetadataValue {
|
||||||
'value': 'true',
|
return Object.assign(new MetadataValue(), {
|
||||||
'language': null,
|
'value': enabled,
|
||||||
'authority': null,
|
'language': null,
|
||||||
'confidence': -1,
|
'authority': null,
|
||||||
'place': 0
|
'confidence': -1,
|
||||||
});
|
'place': 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export const mockRouteService = jasmine.createSpyObj('RouteService', ['getPreviousUrl']);
|
export const mockRouteService = jasmine.createSpyObj('RouteService', ['getPreviousUrl']);
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||||
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
||||||
@@ -26,13 +26,10 @@ import { TruncatableService } from '../../../../shared/truncatable/truncatable.s
|
|||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { GenericItemPageFieldComponent } from '../../field-components/specific-field/generic/generic-item-page-field.component';
|
import { GenericItemPageFieldComponent } from '../../field-components/specific-field/generic/generic-item-page-field.component';
|
||||||
import {
|
import {
|
||||||
createRelationshipsObservable,
|
createRelationshipsObservable, getIIIFEnabled, getIIIFSearchEnabled, mockRouteService
|
||||||
iiifEnabled,
|
|
||||||
iiifSearchEnabled, mockRouteService
|
|
||||||
} from '../shared/item.component.spec';
|
} from '../shared/item.component.spec';
|
||||||
import { UntypedItemComponent } from './untyped-item.component';
|
import { UntypedItemComponent } from './untyped-item.component';
|
||||||
import { RouteService } from '../../../../core/services/route.service';
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
import { of } from 'rxjs';
|
|
||||||
import { createPaginatedList } from '../../../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../../../shared/testing/utils.test';
|
||||||
import { VersionHistoryDataService } from '../../../../core/data/version-history-data.service';
|
import { VersionHistoryDataService } from '../../../../core/data/version-history-data.service';
|
||||||
import { VersionDataService } from '../../../../core/data/version-data.service';
|
import { VersionDataService } from '../../../../core/data/version-data.service';
|
||||||
@@ -41,16 +38,6 @@ import { WorkspaceitemDataService } from '../../../../core/submission/workspacei
|
|||||||
import { SearchService } from '../../../../core/shared/search/search.service';
|
import { SearchService } from '../../../../core/shared/search/search.service';
|
||||||
import { ItemVersionsSharedService } from '../../../../shared/item/item-versions/item-versions-shared.service';
|
import { ItemVersionsSharedService } from '../../../../shared/item/item-versions/item-versions-shared.service';
|
||||||
|
|
||||||
|
|
||||||
const iiifEnabledMap: MetadataMap = {
|
|
||||||
'dspace.iiif.enabled': [iiifEnabled],
|
|
||||||
};
|
|
||||||
|
|
||||||
const iiifEnabledWithSearchMap: MetadataMap = {
|
|
||||||
'dspace.iiif.enabled': [iiifEnabled],
|
|
||||||
'iiif.search.enabled': [iiifSearchEnabled],
|
|
||||||
};
|
|
||||||
|
|
||||||
const noMetadata = new MetadataMap();
|
const noMetadata = new MetadataMap();
|
||||||
|
|
||||||
function getItem(metadata: MetadataMap) {
|
function getItem(metadata: MetadataMap) {
|
||||||
@@ -108,11 +95,12 @@ describe('UntypedItemComponent', () => {
|
|||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).overrideComponent(UntypedItemComponent, {
|
}).overrideComponent(UntypedItemComponent, {
|
||||||
set: {changeDetection: ChangeDetectionStrategy.Default}
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
}).compileComponents();
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('default view', () => {
|
describe('default view', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.compileComponents();
|
||||||
fixture = TestBed.createComponent(UntypedItemComponent);
|
fixture = TestBed.createComponent(UntypedItemComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
comp.object = getItem(noMetadata);
|
comp.object = getItem(noMetadata);
|
||||||
@@ -159,6 +147,41 @@ describe('UntypedItemComponent', () => {
|
|||||||
describe('with IIIF viewer', () => {
|
describe('with IIIF viewer', () => {
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
const iiifEnabledMap: MetadataMap = {
|
||||||
|
'dspace.iiif.enabled': [getIIIFEnabled(true)],
|
||||||
|
'iiif.search.enabled': [getIIIFSearchEnabled(false)],
|
||||||
|
};
|
||||||
|
TestBed.compileComponents();
|
||||||
|
fixture = TestBed.createComponent(UntypedItemComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
comp.object = getItem(iiifEnabledMap);
|
||||||
|
fixture.detectChanges();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should contain an iiif viewer component', () => {
|
||||||
|
const fields = fixture.debugElement.queryAll(By.css('ds-mirador-viewer'));
|
||||||
|
expect(fields.length).toBeGreaterThanOrEqual(1);
|
||||||
|
});
|
||||||
|
it('should not retrieve the query term for previous route', (): void => {
|
||||||
|
expect(comp.iiifQuery$).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('with IIIF viewer and search', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
const localMockRouteService = {
|
||||||
|
getPreviousUrl(): Observable<string> {
|
||||||
|
return of('/search?query=test%20query&fakeParam=true');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const iiifEnabledMap: MetadataMap = {
|
||||||
|
'dspace.iiif.enabled': [getIIIFEnabled(true)],
|
||||||
|
'iiif.search.enabled': [getIIIFSearchEnabled(true)],
|
||||||
|
};
|
||||||
|
TestBed.overrideProvider(RouteService, {useValue: localMockRouteService});
|
||||||
|
TestBed.compileComponents();
|
||||||
fixture = TestBed.createComponent(UntypedItemComponent);
|
fixture = TestBed.createComponent(UntypedItemComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
comp.object = getItem(iiifEnabledMap);
|
comp.object = getItem(iiifEnabledMap);
|
||||||
@@ -170,15 +193,29 @@ describe('UntypedItemComponent', () => {
|
|||||||
expect(fields.length).toBeGreaterThanOrEqual(1);
|
expect(fields.length).toBeGreaterThanOrEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should retrieve the query term for previous route', (): void => {
|
||||||
|
expect(comp.iiifQuery$.subscribe(result => expect(result).toEqual('test query')));
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('with IIIF viewer and search', () => {
|
describe('with IIIF viewer and search but no previous search query', () => {
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
mockRouteService.getPreviousUrl.and.returnValue(of(['/search?q=bird&motivation=painting','/item']));
|
const localMockRouteService = {
|
||||||
|
getPreviousUrl(): Observable<string> {
|
||||||
|
return of('/item');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const iiifEnabledMap: MetadataMap = {
|
||||||
|
'dspace.iiif.enabled': [getIIIFEnabled(true)],
|
||||||
|
'iiif.search.enabled': [getIIIFSearchEnabled(true)],
|
||||||
|
};
|
||||||
|
TestBed.overrideProvider(RouteService, {useValue: localMockRouteService});
|
||||||
|
TestBed.compileComponents();
|
||||||
fixture = TestBed.createComponent(UntypedItemComponent);
|
fixture = TestBed.createComponent(UntypedItemComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
comp.object = getItem(iiifEnabledWithSearchMap);
|
comp.object = getItem(iiifEnabledMap);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -187,9 +224,12 @@ describe('UntypedItemComponent', () => {
|
|||||||
expect(fields.length).toBeGreaterThanOrEqual(1);
|
expect(fields.length).toBeGreaterThanOrEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call the RouteService getHistory method', () => {
|
it('should not retrieve the query term for previous route', fakeAsync( () => {
|
||||||
expect(mockRouteService.getPreviousUrl).toHaveBeenCalled();
|
let emitted;
|
||||||
});
|
comp.iiifQuery$.subscribe(result => emitted = result);
|
||||||
|
tick(10);
|
||||||
|
expect(emitted).toBeUndefined();
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user