#150 TSLint error fixing

This commit is contained in:
Jonas Van Goolen
2017-12-01 13:09:48 +01:00
parent 9b812100b1
commit 1f873acea4
12 changed files with 49 additions and 67 deletions

View File

@@ -40,7 +40,6 @@ describe('ObjectCollectionComponent', () => {
it('should only show the grid component when the viewmode is set to grid', () => { it('should only show the grid component when the viewmode is set to grid', () => {
objectCollectionComponent.currentMode = ViewMode.Grid; objectCollectionComponent.currentMode = ViewMode.Grid;
expect(fixture.debugElement.query(By.css('ds-object-grid'))).toBeDefined(); expect(fixture.debugElement.query(By.css('ds-object-grid'))).toBeDefined();
expect(fixture.debugElement.query(By.css('ds-object-list'))).toBeNull(); expect(fixture.debugElement.query(By.css('ds-object-list'))).toBeNull();
}); });

View File

@@ -65,7 +65,6 @@ export class ObjectCollectionComponent implements OnChanges, OnInit {
} }
} }
ngOnInit(): void { ngOnInit(): void {
// this.pageInfo = this.objects.pageInfo; // this.pageInfo = this.objects.pageInfo;

View File

@@ -3,8 +3,8 @@ import { renderElementsFor } from './dso-element-decorator';
import { Item } from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
describe('ElementDecorator', () => { describe('ElementDecorator', () => {
let gridDecorator = renderElementsFor(Item, ViewMode.Grid); const gridDecorator = renderElementsFor(Item, ViewMode.Grid);
let listDecorator = renderElementsFor(Item, ViewMode.List); const listDecorator = renderElementsFor(Item, ViewMode.List);
it('should have a decorator for both list and grid', () => { it('should have a decorator for both list and grid', () => {
expect(listDecorator.length).not.toBeNull(); expect(listDecorator.length).not.toBeNull();
expect(gridDecorator.length).not.toBeNull(); expect(gridDecorator.length).not.toBeNull();

View File

@@ -6,8 +6,6 @@ import { RouterStub } from '../../testing/router-stub';
import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { Collection } from '../../../core/shared/collection.model'; import { Collection } from '../../../core/shared/collection.model';
let collectionGridElementComponent: CollectionGridElementComponent;
let fixture: ComponentFixture<CollectionGridElementComponent>; let fixture: ComponentFixture<CollectionGridElementComponent>;
const queryParam = 'test query'; const queryParam = 'test query';
const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f'; const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f';
@@ -17,7 +15,7 @@ const activatedRouteStub = {
scope: scopeParam scope: scopeParam
}) })
}; };
let mockCollection: Collection = Object.assign(new Collection(), { const mockCollection: Collection = Object.assign(new Collection(), {
metadata: [ metadata: [
{ {
key: 'dc.description.abstract', key: 'dc.description.abstract',
@@ -25,7 +23,7 @@ let mockCollection: Collection = Object.assign(new Collection(), {
value: 'Short description' value: 'Short description'
}] }]
}); });
let createdGridElementComponent:CollectionGridElementComponent= new CollectionGridElementComponent(mockCollection); const createdGridElementComponent:CollectionGridElementComponent= new CollectionGridElementComponent(mockCollection);
describe('CollectionGridElementComponent', () => { describe('CollectionGridElementComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@@ -50,7 +48,7 @@ describe('CollectionGridElementComponent', () => {
}); });
it('should only show the description if "short description" metadata is present',() => { it('should only show the description if "short description" metadata is present',() => {
let descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); const descriptionText = expect(fixture.debugElement.query(By.css('p.card-text')));
if (mockCollection.shortDescription.length > 0) { if (mockCollection.shortDescription.length > 0) {
expect(descriptionText).toBeDefined(); expect(descriptionText).toBeDefined();

View File

@@ -5,7 +5,6 @@ import { renderElementsFor} from '../../object-collection/shared/dso-element-dec
import { ViewMode } from '../../../+search-page/search-options.model'; import { ViewMode } from '../../../+search-page/search-options.model';
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
@Component({ @Component({
selector: 'ds-collection-grid-element', selector: 'ds-collection-grid-element',
styleUrls: ['./collection-grid-element.component.scss'], styleUrls: ['./collection-grid-element.component.scss'],

View File

@@ -19,7 +19,7 @@ const activatedRouteStub = {
}) })
}; };
let mockCommunity: Community = Object.assign(new Community(), { const mockCommunity: Community = Object.assign(new Community(), {
metadata: [ metadata: [
{ {
key: 'dc.description.abstract', key: 'dc.description.abstract',
@@ -28,7 +28,7 @@ let mockCommunity: Community = Object.assign(new Community(), {
}] }]
}); });
let createdGridElementComponent:CommunityGridElementComponent= new CommunityGridElementComponent(mockCommunity); const createdGridElementComponent:CommunityGridElementComponent= new CommunityGridElementComponent(mockCommunity);
describe('CommunityGridElementComponent', () => { describe('CommunityGridElementComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@@ -55,7 +55,7 @@ describe('CommunityGridElementComponent', () => {
}) })
it('should only show the description if "short description" metadata is present',() => { it('should only show the description if "short description" metadata is present',() => {
let descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); const descriptionText = expect(fixture.debugElement.query(By.css('p.card-text')));
if (mockCommunity.shortDescription.length > 0) { if (mockCommunity.shortDescription.length > 0) {
expect(descriptionText).toBeDefined(); expect(descriptionText).toBeDefined();

View File

@@ -19,7 +19,7 @@ const activatedRouteStub = {
}) })
}; };
/* tslint:disable:no-shadowed-variable */ /* tslint:disable:no-shadowed-variable */
let mockItem: Item = Object.assign(new Item(), { const mockItem: Item = Object.assign(new Item(), {
metadata: [ metadata: [
{ {
key: 'dc.contributor.author', key: 'dc.contributor.author',
@@ -28,7 +28,7 @@ let mockItem: Item = Object.assign(new Item(), {
}] }]
}); });
let createdGridElementComponent:ItemGridElementComponent= new ItemGridElementComponent(mockItem); const createdGridElementComponent:ItemGridElementComponent= new ItemGridElementComponent(mockItem);
describe('ItemGridElementComponent', () => { describe('ItemGridElementComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@@ -55,7 +55,7 @@ describe('ItemGridElementComponent', () => {
}); });
it('should only show the author span if the author metadata is present',() => { it('should only show the author span if the author metadata is present',() => {
let itemAuthorField = expect(fixture.debugElement.query(By.css('p.item-authors'))); const itemAuthorField = expect(fixture.debugElement.query(By.css('p.item-authors')));
if (mockItem.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0) { if (mockItem.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0) {
expect(itemAuthorField).toBeDefined(); expect(itemAuthorField).toBeDefined();
@@ -64,5 +64,4 @@ describe('ItemGridElementComponent', () => {
} }
}); });
}) })

View File

@@ -9,7 +9,6 @@ import { TruncatePipe } from '../../../utils/truncate.pipe';
import { Community } from '../../../../core/shared/community.model'; import { Community } from '../../../../core/shared/community.model';
import { Collection } from '../../../../core/shared/collection.model'; import { Collection } from '../../../../core/shared/collection.model';
let fixture: ComponentFixture<CollectionSearchResultGridElementComponent>; let fixture: ComponentFixture<CollectionSearchResultGridElementComponent>;
const queryParam = 'test query'; const queryParam = 'test query';
const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f'; const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f';
@@ -19,7 +18,7 @@ const activatedRouteStub = {
scope: scopeParam scope: scopeParam
}) })
}; };
let mockCollection: Collection = Object.assign(new Collection(), { const mockCollection: Collection = Object.assign(new Collection(), {
metadata: [ metadata: [
{ {
key: 'dc.description.abstract', key: 'dc.description.abstract',
@@ -29,8 +28,7 @@ let mockCollection: Collection = Object.assign(new Collection(), {
}); });
let createdGridElementComponent: CollectionSearchResultGridElementComponent = new CollectionSearchResultGridElementComponent(mockCollection); const createdGridElementComponent: CollectionSearchResultGridElementComponent = new CollectionSearchResultGridElementComponent(mockCollection);
describe('CollectionSearchResultGridElementComponent', () => { describe('CollectionSearchResultGridElementComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@@ -54,9 +52,8 @@ describe('CollectionSearchResultGridElementComponent', () => {
expect(fixture.debugElement.query(By.css('ds-collection-search-result-grid-element'))).toBeDefined(); expect(fixture.debugElement.query(By.css('ds-collection-search-result-grid-element'))).toBeDefined();
}); });
it('should only show the description if "short description" metadata is present',() => { it('should only show the description if "short description" metadata is present',() => {
let descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); const descriptionText = expect(fixture.debugElement.query(By.css('p.card-text')));
if (mockCollection.shortDescription.length > 0) { if (mockCollection.shortDescription.length > 0) {
expect(descriptionText).toBeDefined(); expect(descriptionText).toBeDefined();

View File

@@ -8,8 +8,6 @@ import { By } from '@angular/platform-browser';
import { TruncatePipe } from '../../../utils/truncate.pipe'; import { TruncatePipe } from '../../../utils/truncate.pipe';
import { Community } from '../../../../core/shared/community.model'; import { Community } from '../../../../core/shared/community.model';
let communitySearchResultGridElementComponent: CommunitySearchResultGridElementComponent;
let fixture: ComponentFixture<CommunitySearchResultGridElementComponent>; let fixture: ComponentFixture<CommunitySearchResultGridElementComponent>;
const queryParam = 'test query'; const queryParam = 'test query';
const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f'; const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f';
@@ -19,7 +17,7 @@ const activatedRouteStub = {
scope: scopeParam scope: scopeParam
}) })
}; };
let mockCommunity: Community = Object.assign(new Community(), { const mockCommunity: Community = Object.assign(new Community(), {
metadata: [ metadata: [
{ {
key: 'dc.description.abstract', key: 'dc.description.abstract',
@@ -29,8 +27,7 @@ let mockCommunity: Community = Object.assign(new Community(), {
}); });
let createdGridElementComponent: CommunitySearchResultGridElementComponent = new CommunitySearchResultGridElementComponent(mockCommunity); const createdGridElementComponent: CommunitySearchResultGridElementComponent = new CommunitySearchResultGridElementComponent(mockCommunity);
describe('CommunitySearchResultGridElementComponent', () => { describe('CommunitySearchResultGridElementComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@@ -54,9 +51,8 @@ describe('CommunitySearchResultGridElementComponent', () => {
expect(fixture.debugElement.query(By.css('ds-community-search-result-grid-element'))).toBeDefined(); expect(fixture.debugElement.query(By.css('ds-community-search-result-grid-element'))).toBeDefined();
}); });
it('should only show the description if "short description" metadata is present',() => { it('should only show the description if "short description" metadata is present',() => {
let descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); const descriptionText = expect(fixture.debugElement.query(By.css('p.card-text')));
if (mockCommunity.shortDescription.length > 0) { if (mockCommunity.shortDescription.length > 0) {
expect(descriptionText).toBeDefined(); expect(descriptionText).toBeDefined();

View File

@@ -8,7 +8,6 @@ import { By } from '@angular/platform-browser';
import { TruncatePipe } from '../../../utils/truncate.pipe'; import { TruncatePipe } from '../../../utils/truncate.pipe';
import { Item } from '../../../../core/shared/item.model'; import { Item } from '../../../../core/shared/item.model';
let itemSearchResultGridElementComponent: ItemSearchResultGridElementComponent; let itemSearchResultGridElementComponent: ItemSearchResultGridElementComponent;
let fixture: ComponentFixture<ItemSearchResultGridElementComponent>; let fixture: ComponentFixture<ItemSearchResultGridElementComponent>;
const queryParam = 'test query'; const queryParam = 'test query';
@@ -19,7 +18,7 @@ const activatedRouteStub = {
scope: scopeParam scope: scopeParam
}) })
}; };
let mockItem: Item = Object.assign(new Item(), { const mockItem: Item = Object.assign(new Item(), {
metadata: [ metadata: [
{ {
key: 'dc.contributor.author', key: 'dc.contributor.author',
@@ -32,7 +31,7 @@ let mockItem: Item = Object.assign(new Item(), {
value: '1650-06-26' value: '1650-06-26'
}] }]
}); });
let createdGridElementComponent:ItemSearchResultGridElementComponent= new ItemSearchResultGridElementComponent(mockItem); const createdGridElementComponent:ItemSearchResultGridElementComponent= new ItemSearchResultGridElementComponent(mockItem);
describe('ItemSearchResultGridElementComponent', () => { describe('ItemSearchResultGridElementComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@@ -59,7 +58,7 @@ describe('ItemSearchResultGridElementComponent', () => {
}); });
it('should only show the author span if the author metadata is present',() => { it('should only show the author span if the author metadata is present',() => {
let itemAuthorField = expect(fixture.debugElement.query(By.css('p.item-authors'))); const itemAuthorField = expect(fixture.debugElement.query(By.css('p.item-authors')));
if (mockItem.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0) { if (mockItem.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0) {
expect(itemAuthorField).toBeDefined(); expect(itemAuthorField).toBeDefined();
@@ -69,7 +68,7 @@ describe('ItemSearchResultGridElementComponent', () => {
}); });
it('should only show the date span if the issuedate is present',() => { it('should only show the date span if the issuedate is present',() => {
let dateField = expect(fixture.debugElement.query(By.css('span.item-list-date'))); const dateField = expect(fixture.debugElement.query(By.css('span.item-list-date')));
if (mockItem.findMetadata('dc.date.issued').length > 0) { if (mockItem.findMetadata('dc.date.issued').length > 0) {
expect(dateField).toBeDefined(); expect(dateField).toBeDefined();
@@ -78,7 +77,4 @@ describe('ItemSearchResultGridElementComponent', () => {
} }
}); });
}); });

View File

@@ -18,7 +18,6 @@ import { fadeIn } from '../animations/fade';
import { ListableObject } from '../object-collection/shared/listable-object.model'; import { ListableObject } from '../object-collection/shared/listable-object.model';
import { hasValue } from '../empty.util'; import { hasValue } from '../empty.util';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.Default, changeDetection: ChangeDetectionStrategy.Default,
encapsulation: ViewEncapsulation.Emulated, encapsulation: ViewEncapsulation.Emulated,