diff --git a/src/app/shared/object-collection/object-collection.component.spec.ts b/src/app/shared/object-collection/object-collection.component.spec.ts index 6793042f35..b27a342eac 100644 --- a/src/app/shared/object-collection/object-collection.component.spec.ts +++ b/src/app/shared/object-collection/object-collection.component.spec.ts @@ -40,7 +40,6 @@ describe('ObjectCollectionComponent', () => { it('should only show the grid component when the viewmode is set to grid', () => { objectCollectionComponent.currentMode = ViewMode.Grid; - expect(fixture.debugElement.query(By.css('ds-object-grid'))).toBeDefined(); expect(fixture.debugElement.query(By.css('ds-object-list'))).toBeNull(); }); diff --git a/src/app/shared/object-collection/object-collection.component.ts b/src/app/shared/object-collection/object-collection.component.ts index 5a356dcbdc..3af92443c1 100644 --- a/src/app/shared/object-collection/object-collection.component.ts +++ b/src/app/shared/object-collection/object-collection.component.ts @@ -65,14 +65,13 @@ export class ObjectCollectionComponent implements OnChanges, OnInit { } } - ngOnInit(): void { // this.pageInfo = this.objects.pageInfo; this.sub = this.route .queryParams .subscribe((params) => { - if(isNotEmpty(params.view)){ + if (isNotEmpty(params.view)) { this.currentMode = params.view; } }); @@ -91,7 +90,7 @@ export class ObjectCollectionComponent implements OnChanges, OnInit { getViewMode(): ViewMode { this.route.queryParams.map((params) => { if (isNotEmpty(params.view) && hasValue(params.view)) { - this.currentMode= params.view; + this.currentMode = params.view; } }); return this.currentMode; diff --git a/src/app/shared/object-collection/shared/dso-element-decorator.spec.ts b/src/app/shared/object-collection/shared/dso-element-decorator.spec.ts index b4b27bb52a..9f54bebed9 100644 --- a/src/app/shared/object-collection/shared/dso-element-decorator.spec.ts +++ b/src/app/shared/object-collection/shared/dso-element-decorator.spec.ts @@ -3,8 +3,8 @@ import { renderElementsFor } from './dso-element-decorator'; import { Item } from '../../../core/shared/item.model'; describe('ElementDecorator', () => { - let gridDecorator = renderElementsFor(Item, ViewMode.Grid); - let listDecorator = renderElementsFor(Item, ViewMode.List); + const gridDecorator = renderElementsFor(Item, ViewMode.Grid); + const listDecorator = renderElementsFor(Item, ViewMode.List); it('should have a decorator for both list and grid', () => { expect(listDecorator.length).not.toBeNull(); expect(gridDecorator.length).not.toBeNull(); diff --git a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts index fd935af992..eaa6edc4d0 100644 --- a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.spec.ts @@ -6,8 +6,6 @@ import { RouterStub } from '../../testing/router-stub'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; import { Collection } from '../../../core/shared/collection.model'; - -let collectionGridElementComponent: CollectionGridElementComponent; let fixture: ComponentFixture; const queryParam = 'test query'; const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f'; @@ -17,7 +15,7 @@ const activatedRouteStub = { scope: scopeParam }) }; -let mockCollection: Collection = Object.assign(new Collection(), { +const mockCollection: Collection = Object.assign(new Collection(), { metadata: [ { key: 'dc.description.abstract', @@ -25,7 +23,7 @@ let mockCollection: Collection = Object.assign(new Collection(), { value: 'Short description' }] }); -let createdGridElementComponent:CollectionGridElementComponent= new CollectionGridElementComponent(mockCollection); +const createdGridElementComponent:CollectionGridElementComponent= new CollectionGridElementComponent(mockCollection); describe('CollectionGridElementComponent', () => { beforeEach(async(() => { @@ -45,16 +43,16 @@ describe('CollectionGridElementComponent', () => { fixture = TestBed.createComponent(CollectionGridElementComponent); })); - it('should show the collection cards in the grid element',()=>{ + it('should show the collection cards in the grid element',() => { expect(fixture.debugElement.query(By.css('ds-collection-grid-element'))).toBeDefined(); }); - it('should only show the description if "short description" metadata is present',()=>{ - let descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); + it('should only show the description if "short description" metadata is present',() => { + const descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); - if(mockCollection.shortDescription.length>0){ + if (mockCollection.shortDescription.length > 0) { expect(descriptionText).toBeDefined(); - }else{ + }else { expect(descriptionText).not.toBeDefined(); } }); diff --git a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.ts b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.ts index a7f5ef3e49..f383367e3f 100644 --- a/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.ts +++ b/src/app/shared/object-grid/collection-grid-element/collection-grid-element.component.ts @@ -5,7 +5,6 @@ import { renderElementsFor} from '../../object-collection/shared/dso-element-dec import { ViewMode } from '../../../+search-page/search-options.model'; import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; - @Component({ selector: 'ds-collection-grid-element', styleUrls: ['./collection-grid-element.component.scss'], diff --git a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts index dc837e3c0c..cb9e20449e 100644 --- a/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/community-grid-element/community-grid-element.component.spec.ts @@ -19,7 +19,7 @@ const activatedRouteStub = { }) }; -let mockCommunity: Community = Object.assign(new Community(), { +const mockCommunity: Community = Object.assign(new Community(), { metadata: [ { 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', () => { beforeEach(async(() => { @@ -50,16 +50,16 @@ describe('CommunityGridElementComponent', () => { })); - it('should show the community cards in the grid element',()=>{ + it('should show the community cards in the grid element',() => { expect(fixture.debugElement.query(By.css('ds-community-grid-element'))).toBeDefined(); }) - it('should only show the description if "short description" metadata is present',()=>{ - let descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); + it('should only show the description if "short description" metadata is present',() => { + const descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); - if(mockCommunity.shortDescription.length>0){ + if (mockCommunity.shortDescription.length > 0) { expect(descriptionText).toBeDefined(); - }else{ + }else { expect(descriptionText).not.toBeDefined(); } }); diff --git a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.spec.ts b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.spec.ts index 8913dca3ee..3be46965ee 100644 --- a/src/app/shared/object-grid/item-grid-element/item-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/item-grid-element/item-grid-element.component.spec.ts @@ -19,7 +19,7 @@ const activatedRouteStub = { }) }; /* tslint:disable:no-shadowed-variable */ -let mockItem: Item = Object.assign(new Item(), { +const mockItem: Item = Object.assign(new Item(), { metadata: [ { 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', () => { beforeEach(async(() => { @@ -50,19 +50,18 @@ describe('ItemGridElementComponent', () => { })); - it('should show the item cards in the grid element',()=>{ + it('should show the item cards in the grid element',() => { expect(fixture.debugElement.query(By.css('ds-item-grid-element'))).toBeDefined() }); - it('should only show the author span if the author metadata is present',()=>{ - let itemAuthorField = expect(fixture.debugElement.query(By.css('p.item-authors'))); + it('should only show the author span if the author metadata is present',() => { + 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(); - }else{ + }else { expect(itemAuthorField).toBeDefined(); } }); - }) diff --git a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts index 8d6fe6fb38..a3b3710080 100644 --- a/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component.spec.ts @@ -9,7 +9,6 @@ import { TruncatePipe } from '../../../utils/truncate.pipe'; import { Community } from '../../../../core/shared/community.model'; import { Collection } from '../../../../core/shared/collection.model'; - let fixture: ComponentFixture; const queryParam = 'test query'; const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f'; @@ -19,7 +18,7 @@ const activatedRouteStub = { scope: scopeParam }) }; -let mockCollection: Collection = Object.assign(new Collection(), { +const mockCollection: Collection = Object.assign(new Collection(), { metadata: [ { 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', () => { beforeEach(async(() => { @@ -54,13 +52,12 @@ describe('CollectionSearchResultGridElementComponent', () => { 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',() => { + const descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); - it('should only show the description if "short description" metadata is present',()=>{ - let descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); - - if(mockCollection.shortDescription.length>0){ + if (mockCollection.shortDescription.length > 0) { expect(descriptionText).toBeDefined(); - }else{ + }else { expect(descriptionText).not.toBeDefined(); } }); diff --git a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts index 0924700da7..dd9e16a120 100644 --- a/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component.spec.ts @@ -8,8 +8,6 @@ import { By } from '@angular/platform-browser'; import { TruncatePipe } from '../../../utils/truncate.pipe'; import { Community } from '../../../../core/shared/community.model'; - -let communitySearchResultGridElementComponent: CommunitySearchResultGridElementComponent; let fixture: ComponentFixture; const queryParam = 'test query'; const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f'; @@ -19,7 +17,7 @@ const activatedRouteStub = { scope: scopeParam }) }; -let mockCommunity: Community = Object.assign(new Community(), { +const mockCommunity: Community = Object.assign(new Community(), { metadata: [ { 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', () => { beforeEach(async(() => { @@ -54,13 +51,12 @@ describe('CommunitySearchResultGridElementComponent', () => { 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',() => { + const descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); - it('should only show the description if "short description" metadata is present',()=>{ - let descriptionText = expect(fixture.debugElement.query(By.css('p.card-text'))); - - if(mockCommunity.shortDescription.length>0){ + if (mockCommunity.shortDescription.length > 0) { expect(descriptionText).toBeDefined(); - }else{ + }else { expect(descriptionText).not.toBeDefined(); } }); diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts index 318910304f..1a2ca908e2 100644 --- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item-search-result-grid-element.component.spec.ts @@ -8,7 +8,6 @@ import { By } from '@angular/platform-browser'; import { TruncatePipe } from '../../../utils/truncate.pipe'; import { Item } from '../../../../core/shared/item.model'; - let itemSearchResultGridElementComponent: ItemSearchResultGridElementComponent; let fixture: ComponentFixture; const queryParam = 'test query'; @@ -19,7 +18,7 @@ const activatedRouteStub = { scope: scopeParam }) }; -let mockItem: Item = Object.assign(new Item(), { +const mockItem: Item = Object.assign(new Item(), { metadata: [ { key: 'dc.contributor.author', @@ -32,7 +31,7 @@ let mockItem: Item = Object.assign(new Item(), { value: '1650-06-26' }] }); -let createdGridElementComponent:ItemSearchResultGridElementComponent= new ItemSearchResultGridElementComponent(mockItem); +const createdGridElementComponent:ItemSearchResultGridElementComponent= new ItemSearchResultGridElementComponent(mockItem); describe('ItemSearchResultGridElementComponent', () => { beforeEach(async(() => { @@ -54,31 +53,28 @@ describe('ItemSearchResultGridElementComponent', () => { })); - it('should show the item result cards in the grid element',()=>{ + it('should show the item result cards in the grid element',() => { expect(fixture.debugElement.query(By.css('ds-item-search-result-grid-element'))).toBeDefined(); }); - it('should only show the author span if the author metadata is present',()=>{ - let itemAuthorField = expect(fixture.debugElement.query(By.css('p.item-authors'))); + it('should only show the author span if the author metadata is present',() => { + 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(); - }else{ + }else { expect(itemAuthorField).not.toBeDefined(); } }); - it('should only show the date span if the issuedate is present',()=>{ - let dateField = expect(fixture.debugElement.query(By.css('span.item-list-date'))); + it('should only show the date span if the issuedate is present',() => { + 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(); - }else{ + }else { expect(dateField).not.toBeDefined(); } }); - - - }); diff --git a/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.spec.ts b/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.spec.ts index 5b02fbe95a..390b003e2e 100644 --- a/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.spec.ts +++ b/src/app/shared/object-grid/wrapper-grid-element/wrapper-grid-element.component.spec.ts @@ -37,7 +37,7 @@ describe('WrapperGridElementComponent', () => { })); - it('should show the wrapper element containing the cards',()=>{ + it('should show the wrapper element containing the cards',() => { expect(fixture.debugElement.query(By.css('ds-collection-grid-element'))).toBeDefined(); }) }) diff --git a/src/app/shared/object-list/object-list.component.ts b/src/app/shared/object-list/object-list.component.ts index a300e06f59..b9abed37ac 100644 --- a/src/app/shared/object-list/object-list.component.ts +++ b/src/app/shared/object-list/object-list.component.ts @@ -18,7 +18,6 @@ import { fadeIn } from '../animations/fade'; import { ListableObject } from '../object-collection/shared/listable-object.model'; import { hasValue } from '../empty.util'; - @Component({ changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.Emulated,