mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 13:03:04 +00:00

Conflicts: src/app/core/shared/item.model.ts src/app/entity-groups/journal-entities/item-grid-elements/journal-issue/journal-issue-grid-element.component.spec.ts src/app/entity-groups/journal-entities/item-grid-elements/journal-volume/journal-volume-grid-element.component.spec.ts src/app/entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component.spec.ts src/app/entity-groups/journal-entities/item-list-elements/journal-issue/journal-issue-list-element.component.spec.ts src/app/entity-groups/journal-entities/item-list-elements/journal-volume/journal-volume-list-element.component.spec.ts src/app/entity-groups/journal-entities/item-list-elements/journal/journal-list-element.component.spec.ts src/app/entity-groups/research-entities/item-grid-elements/person/person-grid-element.component.spec.ts src/app/entity-groups/research-entities/item-grid-elements/project/project-grid-element.component.spec.ts src/app/entity-groups/research-entities/item-list-elements/orgunit/orgunit-list-element.component.spec.ts src/app/entity-groups/research-entities/item-list-elements/person/person-list-element.component.spec.ts src/app/entity-groups/research-entities/item-list-elements/project/project-list-element.component.spec.ts src/app/shared/object-grid/item-grid-element/item-grid-element.component.spec.ts src/app/shared/object-grid/item-grid-element/item-types/publication/publication-grid-element.component.spec.ts src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.spec.ts src/app/shared/testing/utils.ts
70 lines
2.3 KiB
TypeScript
70 lines
2.3 KiB
TypeScript
import { Item } from '../../../../core/shared/item.model';
|
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
|
import { ProjectGridElementComponent } from './project-grid-element.component';
|
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
|
import { PaginatedList } from '../../../../core/data/paginated-list';
|
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
|
import { async, TestBed } from '@angular/core/testing';
|
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
import { By } from '@angular/platform-browser';
|
|
|
|
const mockItem = Object.assign(new Item(), {
|
|
bundles: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
|
|
metadata: {
|
|
'dc.title': [
|
|
{
|
|
language: 'en_US',
|
|
value: 'This is just another title'
|
|
}
|
|
],
|
|
'dc.description': [
|
|
{
|
|
language: 'en_US',
|
|
value: 'The project description'
|
|
}
|
|
]
|
|
}
|
|
});
|
|
|
|
describe('ProjectGridElementComponent', () => {
|
|
let comp;
|
|
let fixture;
|
|
|
|
const truncatableServiceStub: any = {
|
|
isCollapsed: (id: number) => observableOf(true),
|
|
};
|
|
|
|
beforeEach(async(() => {
|
|
TestBed.configureTestingModule({
|
|
imports: [NoopAnimationsModule],
|
|
declarations: [ProjectGridElementComponent, TruncatePipe],
|
|
providers: [
|
|
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
|
],
|
|
schemas: [NO_ERRORS_SCHEMA]
|
|
}).overrideComponent(ProjectGridElementComponent, {
|
|
set: { changeDetection: ChangeDetectionStrategy.Default }
|
|
}).compileComponents();
|
|
}));
|
|
|
|
beforeEach(async(() => {
|
|
fixture = TestBed.createComponent(ProjectGridElementComponent);
|
|
comp = fixture.componentInstance;
|
|
}));
|
|
|
|
describe(`when the project is rendered`, () => {
|
|
beforeEach(() => {
|
|
comp.object = mockItem;
|
|
fixture.detectChanges();
|
|
});
|
|
|
|
it(`should contain a ProjectGridElementComponent`, () => {
|
|
const projectGridElement = fixture.debugElement.query(By.css(`ds-project-search-result-grid-element`));
|
|
expect(projectGridElement).not.toBeNull();
|
|
});
|
|
});
|
|
});
|