mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Updated iiif component tests.
This commit is contained in:
@@ -3,7 +3,7 @@ import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angula
|
|||||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
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 as observableOf} from 'rxjs';
|
||||||
import { GenericItemPageFieldComponent } from '../../../../+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component';
|
import { GenericItemPageFieldComponent } from '../../../../+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component';
|
||||||
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';
|
||||||
@@ -27,6 +27,8 @@ import { TruncatableService } from '../../../../shared/truncatable/truncatable.s
|
|||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { IIIFSearchableComponent } from './iiif-searchable.component';
|
import { IIIFSearchableComponent } from './iiif-searchable.component';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
import {RelationshipService} from '../../../../core/data/relationship.service';
|
||||||
|
import {RouteService} from '../../../../core/services/route.service';
|
||||||
|
|
||||||
let comp: IIIFSearchableComponent;
|
let comp: IIIFSearchableComponent;
|
||||||
let fixture: ComponentFixture<IIIFSearchableComponent>;
|
let fixture: ComponentFixture<IIIFSearchableComponent>;
|
||||||
@@ -56,6 +58,10 @@ const mockItem: Item = Object.assign(new Item(), {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const routeServiceStub = jasmine.createSpyObj('routeService', {
|
||||||
|
getHistory: observableOf(['/search',''])
|
||||||
|
});
|
||||||
|
|
||||||
describe('IIIFSearchableComponent', () => {
|
describe('IIIFSearchableComponent', () => {
|
||||||
const mockBitstreamDataService = {
|
const mockBitstreamDataService = {
|
||||||
getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
|
getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
|
||||||
@@ -74,6 +80,7 @@ describe('IIIFSearchableComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: ItemDataService, useValue: {} },
|
{ provide: ItemDataService, useValue: {} },
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
|
{ provide: RelationshipService, useValue: {} },
|
||||||
{ provide: ObjectCacheService, useValue: {} },
|
{ provide: ObjectCacheService, useValue: {} },
|
||||||
{ provide: UUIDService, useValue: {} },
|
{ provide: UUIDService, useValue: {} },
|
||||||
{ provide: Store, useValue: {} },
|
{ provide: Store, useValue: {} },
|
||||||
@@ -85,6 +92,7 @@ describe('IIIFSearchableComponent', () => {
|
|||||||
{ provide: NotificationsService, useValue: {} },
|
{ provide: NotificationsService, useValue: {} },
|
||||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||||
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
||||||
|
{provide: RouteService, useValue: routeServiceStub}
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -101,7 +109,6 @@ describe('IIIFSearchableComponent', () => {
|
|||||||
}));
|
}));
|
||||||
it(`should set searchable attribute to true`, () => {
|
it(`should set searchable attribute to true`, () => {
|
||||||
const miradorEl = fixture.debugElement.query(By.css('ds-mirador-viewer'));
|
const miradorEl = fixture.debugElement.query(By.css('ds-mirador-viewer'));
|
||||||
console.log(miradorEl);
|
|
||||||
expect(miradorEl.nativeElement.getAttribute('searchable')).toBeTruthy();
|
expect(miradorEl.nativeElement.getAttribute('searchable')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ import { TruncatableService } from '../../../../shared/truncatable/truncatable.s
|
|||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { IIIFComponent } from './iiif.component';
|
import { IIIFComponent } from './iiif.component';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
import {RelationshipService} from '../../../../core/data/relationship.service';
|
||||||
|
|
||||||
let comp: IIIFComponent;
|
let comp: IIIFComponent;
|
||||||
let fixture: ComponentFixture<IIIFComponent>;
|
let fixture: ComponentFixture<IIIFComponent>;
|
||||||
@@ -56,7 +57,7 @@ const mockItem: Item = Object.assign(new Item(), {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('IIIFSearchableComponent', () => {
|
describe('IIIFComponent', () => {
|
||||||
const mockBitstreamDataService = {
|
const mockBitstreamDataService = {
|
||||||
getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
|
getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
|
||||||
return createSuccessfulRemoteDataObject$(new Bitstream());
|
return createSuccessfulRemoteDataObject$(new Bitstream());
|
||||||
@@ -74,6 +75,7 @@ describe('IIIFSearchableComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: ItemDataService, useValue: {} },
|
{ provide: ItemDataService, useValue: {} },
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
|
{ provide: RelationshipService, useValue: {} },
|
||||||
{ provide: ObjectCacheService, useValue: {} },
|
{ provide: ObjectCacheService, useValue: {} },
|
||||||
{ provide: UUIDService, useValue: {} },
|
{ provide: UUIDService, useValue: {} },
|
||||||
{ provide: Store, useValue: {} },
|
{ provide: Store, useValue: {} },
|
||||||
|
Reference in New Issue
Block a user