mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 05:23:06 +00:00
added tests, aot fixes, lint fixes
This commit is contained in:
@@ -11,5 +11,5 @@ import { listableObjectComponent } from '../../object-collection/shared/listable
|
||||
templateUrl: './collection-grid-element.component.html'
|
||||
})
|
||||
|
||||
@listableObjectComponent(Collection.name, ViewMode.GridElement)
|
||||
@listableObjectComponent(Collection, ViewMode.GridElement)
|
||||
export class CollectionGridElementComponent extends AbstractListableElementComponent<Collection> {}
|
||||
|
@@ -11,5 +11,5 @@ import { listableObjectComponent } from '../../object-collection/shared/listable
|
||||
templateUrl: './community-grid-element.component.html'
|
||||
})
|
||||
|
||||
@listableObjectComponent(Community.name, ViewMode.GridElement)
|
||||
@listableObjectComponent(Community, ViewMode.GridElement)
|
||||
export class CommunityGridElementComponent extends AbstractListableElementComponent<Community> {}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TruncatePipe } from '../../../../utils/truncate.pipe';
|
||||
import { TruncatableService } from '../../../../truncatable/truncatable.service';
|
||||
@@ -6,12 +6,10 @@ import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { PublicationGridElementComponent } from './publication-grid-element.component';
|
||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../testing/utils';
|
||||
import { PaginatedList } from '../../../../../core/data/paginated-list';
|
||||
import { PageInfo } from '../../../../../core/shared/page-info.model';
|
||||
import { JournalGridElementComponent } from '../../../../../entity-groups/journal-entities/item-grid-elements/journal/journal-grid-element.component';
|
||||
|
||||
const mockItem = Object.assign(new Item(), {
|
||||
bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
|
||||
@@ -43,43 +41,41 @@ const mockItem = Object.assign(new Item(), {
|
||||
}
|
||||
});
|
||||
|
||||
describe('PublicationGridElementComponent',
|
||||
() => {
|
||||
let comp;
|
||||
let fixture;
|
||||
describe('PublicationGridElementComponent', () => {
|
||||
let comp;
|
||||
let fixture;
|
||||
|
||||
const truncatableServiceStub: any = {
|
||||
isCollapsed: (id: number) => observableOf(true),
|
||||
};
|
||||
const truncatableServiceStub: any = {
|
||||
isCollapsed: (id: number) => observableOf(true),
|
||||
};
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopAnimationsModule],
|
||||
declarations: [PublicationGridElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(PublicationGridElementComponent, {
|
||||
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||
}).compileComponents();
|
||||
}));
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopAnimationsModule],
|
||||
declarations: [PublicationGridElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(PublicationGridElementComponent, {
|
||||
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(async(() => {
|
||||
fixture = TestBed.createComponent(PublicationGridElementComponent);
|
||||
comp = fixture.componentInstance;
|
||||
}));
|
||||
beforeEach(async(() => {
|
||||
fixture = TestBed.createComponent(PublicationGridElementComponent);
|
||||
comp = fixture.componentInstance;
|
||||
}));
|
||||
|
||||
describe(`when the publication is rendered`, () => {
|
||||
beforeEach(() => {
|
||||
comp.object = mockItem;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it(`should contain a PublicationGridElementComponent`, () => {
|
||||
const publicationGridElement = fixture.debugElement.query(By.css(`ds-publication-search-result-grid-element`));
|
||||
expect(publicationGridElement).not.toBeNull();
|
||||
});
|
||||
describe(`when the publication is rendered`, () => {
|
||||
beforeEach(() => {
|
||||
comp.object = mockItem;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
});
|
||||
it(`should contain a PublicationGridElementComponent`, () => {
|
||||
const publicationGridElement = fixture.debugElement.query(By.css(`ds-publication-search-result-grid-element`));
|
||||
expect(publicationGridElement).not.toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -6,7 +6,7 @@ import { AbstractListableElementComponent } from '../../../../object-collection/
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
|
||||
@listableObjectComponent('Publication', ViewMode.GridElement)
|
||||
@listableObjectComponent(Item.name, ViewMode.GridElement)
|
||||
@listableObjectComponent(Item, ViewMode.GridElement)
|
||||
@Component({
|
||||
selector: 'ds-publication-grid-element',
|
||||
styleUrls: ['./publication-grid-element.component.scss'],
|
||||
|
@@ -12,5 +12,5 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista
|
||||
templateUrl: 'collection-search-result-grid-element.component.html'
|
||||
})
|
||||
|
||||
@listableObjectComponent(CollectionSearchResult.name, ViewMode.GridElement)
|
||||
@listableObjectComponent(CollectionSearchResult, ViewMode.GridElement)
|
||||
export class CollectionSearchResultGridElementComponent extends SearchResultGridElementComponent<CollectionSearchResult, Collection> {}
|
||||
|
@@ -11,7 +11,7 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista
|
||||
templateUrl: 'community-search-result-grid-element.component.html'
|
||||
})
|
||||
|
||||
@listableObjectComponent(CommunitySearchResult.name, ViewMode.GridElement)
|
||||
@listableObjectComponent(CommunitySearchResult, ViewMode.GridElement)
|
||||
export class CommunitySearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult, Community> {
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user