diff --git a/src/app/+item-page/edit-item-page/item-private/item-private.component.spec.ts b/src/app/+item-page/edit-item-page/item-private/item-private.component.spec.ts index 52ccbc2133..80910a85c2 100644 --- a/src/app/+item-page/edit-item-page/item-private/item-private.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-private/item-private.component.spec.ts @@ -1,8 +1,7 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Item } from '../../../core/shared/item.model'; import { RouterStub } from '../../../shared/testing/router.stub'; import { of as observableOf } from 'rxjs'; -import { RemoteData } from '../../../core/data/remote-data'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; @@ -31,7 +30,7 @@ let successfulRestResponse; let failRestResponse; describe('ItemPrivateComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { mockItem = Object.assign(new Item(), { id: 'fake-id', diff --git a/src/app/+item-page/edit-item-page/item-private/item-private.component.ts b/src/app/+item-page/edit-item-page/item-private/item-private.component.ts index d949e4fa6e..67b9b43786 100644 --- a/src/app/+item-page/edit-item-page/item-private/item-private.component.ts +++ b/src/app/+item-page/edit-item-page/item-private/item-private.component.ts @@ -1,9 +1,15 @@ import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + +import { TranslateService } from '@ngx-translate/core'; import { first } from 'rxjs/operators'; + import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; import { RemoteData } from '../../../core/data/remote-data'; import { Item } from '../../../core/shared/item.model'; import { RestResponse } from '../../../core/cache/response.models'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { ItemDataService } from '../../../core/data/item-data.service'; @Component({ selector: 'ds-item-private', @@ -17,6 +23,14 @@ export class ItemPrivateComponent extends AbstractSimpleItemActionComponent { protected messageKey = 'private'; protected predicate = (rd: RemoteData) => !rd.payload.isDiscoverable; + constructor(protected route: ActivatedRoute, + protected router: Router, + protected notificationsService: NotificationsService, + protected itemDataService: ItemDataService, + protected translateService: TranslateService) { + super(route, router, notificationsService, itemDataService, translateService); + } + /** * Perform the make private action to the item */ diff --git a/src/app/+item-page/edit-item-page/item-public/item-public.component.spec.ts b/src/app/+item-page/edit-item-page/item-public/item-public.component.spec.ts index 1143874709..a26a03b97a 100644 --- a/src/app/+item-page/edit-item-page/item-public/item-public.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-public/item-public.component.spec.ts @@ -1,8 +1,7 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Item } from '../../../core/shared/item.model'; import { RouterStub } from '../../../shared/testing/router.stub'; import { of as observableOf } from 'rxjs'; -import { RemoteData } from '../../../core/data/remote-data'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; @@ -31,7 +30,7 @@ let successfulRestResponse; let failRestResponse; describe('ItemPublicComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { mockItem = Object.assign(new Item(), { id: 'fake-id', diff --git a/src/app/+item-page/edit-item-page/item-public/item-public.component.ts b/src/app/+item-page/edit-item-page/item-public/item-public.component.ts index 272cf9a96f..b2c9c39c42 100644 --- a/src/app/+item-page/edit-item-page/item-public/item-public.component.ts +++ b/src/app/+item-page/edit-item-page/item-public/item-public.component.ts @@ -1,9 +1,15 @@ import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + import { first } from 'rxjs/operators'; +import { TranslateService } from '@ngx-translate/core'; + import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; import { RemoteData } from '../../../core/data/remote-data'; import { Item } from '../../../core/shared/item.model'; import { RestResponse } from '../../../core/cache/response.models'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { ItemDataService } from '../../../core/data/item-data.service'; @Component({ selector: 'ds-item-public', @@ -17,6 +23,14 @@ export class ItemPublicComponent extends AbstractSimpleItemActionComponent { protected messageKey = 'public'; protected predicate = (rd: RemoteData) => rd.payload.isDiscoverable; + constructor(protected route: ActivatedRoute, + protected router: Router, + protected notificationsService: NotificationsService, + protected itemDataService: ItemDataService, + protected translateService: TranslateService) { + super(route, router, notificationsService, itemDataService, translateService); + } + /** * Perform the make public action to the item */ diff --git a/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.spec.ts b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.spec.ts index 005f330df9..7516694a42 100644 --- a/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.spec.ts @@ -1,8 +1,7 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Item } from '../../../core/shared/item.model'; import { RouterStub } from '../../../shared/testing/router.stub'; import { of as observableOf } from 'rxjs'; -import { RemoteData } from '../../../core/data/remote-data'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; @@ -31,7 +30,7 @@ let successfulRestResponse; let failRestResponse; describe('ItemReinstateComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { mockItem = Object.assign(new Item(), { id: 'fake-id', diff --git a/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.ts b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.ts index 9c0e1c8d05..51f0d941d4 100644 --- a/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.ts +++ b/src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.ts @@ -1,9 +1,15 @@ import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + import { first } from 'rxjs/operators'; +import { TranslateService } from '@ngx-translate/core'; + import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; import { RemoteData } from '../../../core/data/remote-data'; import { Item } from '../../../core/shared/item.model'; import { RestResponse } from '../../../core/cache/response.models'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { ItemDataService } from '../../../core/data/item-data.service'; @Component({ selector: 'ds-item-reinstate', @@ -17,6 +23,14 @@ export class ItemReinstateComponent extends AbstractSimpleItemActionComponent { protected messageKey = 'reinstate'; protected predicate = (rd: RemoteData) => !rd.payload.isWithdrawn; + constructor(protected route: ActivatedRoute, + protected router: Router, + protected notificationsService: NotificationsService, + protected itemDataService: ItemDataService, + protected translateService: TranslateService) { + super(route, router, notificationsService, itemDataService, translateService); + } + /** * Perform the reinstate action to the item */ diff --git a/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.spec.ts b/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.spec.ts index aa6a3e537a..e1608225c9 100644 --- a/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.spec.ts +++ b/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.spec.ts @@ -1,8 +1,7 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Item } from '../../../core/shared/item.model'; import { RouterStub } from '../../../shared/testing/router.stub'; import { of as observableOf } from 'rxjs'; -import { RemoteData } from '../../../core/data/remote-data'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; @@ -31,7 +30,7 @@ let successfulRestResponse; let failRestResponse; describe('ItemWithdrawComponent', () => { - beforeEach(async(() => { + beforeEach(waitForAsync(() => { mockItem = Object.assign(new Item(), { id: 'fake-id', diff --git a/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.ts b/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.ts index 1fed1756a4..70600f962a 100644 --- a/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.ts +++ b/src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.ts @@ -1,9 +1,15 @@ import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + import { first } from 'rxjs/operators'; +import { TranslateService } from '@ngx-translate/core'; + import { AbstractSimpleItemActionComponent } from '../simple-item-action/abstract-simple-item-action.component'; import { RemoteData } from '../../../core/data/remote-data'; import { Item } from '../../../core/shared/item.model'; import { RestResponse } from '../../../core/cache/response.models'; +import { NotificationsService } from '../../../shared/notifications/notifications.service'; +import { ItemDataService } from '../../../core/data/item-data.service'; @Component({ selector: 'ds-item-withdraw', @@ -17,6 +23,14 @@ export class ItemWithdrawComponent extends AbstractSimpleItemActionComponent { protected messageKey = 'withdraw'; protected predicate = (rd: RemoteData) => rd.payload.isWithdrawn; + constructor(protected route: ActivatedRoute, + protected router: Router, + protected notificationsService: NotificationsService, + protected itemDataService: ItemDataService, + protected translateService: TranslateService) { + super(route, router, notificationsService, itemDataService, translateService); + } + /** * Perform the withdraw action to the item */ diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.spec.ts index 6c2502a92b..f3ff349980 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.spec.ts @@ -1,6 +1,6 @@ import { DynamicFormsCoreModule, DynamicFormService } from '@ng-dynamic-forms/core'; import { FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'; +import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing'; import { DebugElement } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TextMaskModule } from 'angular2-text-mask'; @@ -18,7 +18,7 @@ describe('CustomSwitchComponent', () => { let debugElement: DebugElement; let testElement: DebugElement; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ ReactiveFormsModule, diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.ts index ab02fc159d..5b3f1e89e4 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component.ts @@ -1,6 +1,9 @@ -import { DynamicNGBootstrapCheckboxComponent } from '@ng-dynamic-forms/ui-ng-bootstrap'; import { Component, EventEmitter, Input, Output } from '@angular/core'; import { FormGroup } from '@angular/forms'; + +import { DynamicNGBootstrapCheckboxComponent } from '@ng-dynamic-forms/ui-ng-bootstrap'; +import { DynamicFormLayoutService, DynamicFormValidationService } from '@ng-dynamic-forms/core'; + import { DynamicCustomSwitchModel } from './custom-switch.model'; @Component({ @@ -52,4 +55,8 @@ export class CustomSwitchComponent extends DynamicNGBootstrapCheckboxComponent { * Emit an event when the input is focused */ @Output() focus = new EventEmitter(); + + constructor(layoutService: DynamicFormLayoutService, validationService: DynamicFormValidationService) { + super(layoutService, validationService); + } } diff --git a/src/app/shared/starts-with/date/starts-with-date.component.spec.ts b/src/app/shared/starts-with/date/starts-with-date.component.spec.ts index 1f5b6aa30e..33edcfa5fd 100644 --- a/src/app/shared/starts-with/date/starts-with-date.component.spec.ts +++ b/src/app/shared/starts-with/date/starts-with-date.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -25,7 +25,7 @@ describe('StartsWithDateComponent', () => { queryParams: observableOf({}) }); - beforeEach(async(() => { + beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], declarations: [StartsWithDateComponent, EnumKeysPipe], diff --git a/src/app/shared/starts-with/date/starts-with-date.component.ts b/src/app/shared/starts-with/date/starts-with-date.component.ts index 5f87ce8635..75173212f9 100644 --- a/src/app/shared/starts-with/date/starts-with-date.component.ts +++ b/src/app/shared/starts-with/date/starts-with-date.component.ts @@ -1,4 +1,6 @@ -import { Component } from '@angular/core'; +import { Component, Inject } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; + import { renderStartsWithFor, StartsWithType } from '../starts-with-decorator'; import { StartsWithAbstractComponent } from '../starts-with-abstract.component'; import { hasValue } from '../../empty.util'; @@ -30,6 +32,12 @@ export class StartsWithDateComponent extends StartsWithAbstractComponent { */ startsWithYear: number; + public constructor(@Inject('startsWithOptions') public startsWithOptions: any[], + protected route: ActivatedRoute, + protected router: Router) { + super(startsWithOptions, route, router); + } + ngOnInit() { this.monthOptions = [ 'none',