Fixed linting and test

This commit is contained in:
Erik Tiekstra
2021-10-11 09:06:06 +02:00
parent d4a4edbd1c
commit fe1d30964d
5 changed files with 17 additions and 16 deletions

View File

@@ -1,18 +1,15 @@
import { Component, ChangeDetectionStrategy, Input, EventEmitter, Output } from '@angular/core';
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { FormGroup } from '@angular/forms';
@Component({
selector: 'msfa-periodisk-redovisning-form',
templateUrl: './periodisk-redovisning-form.component.html',
styleUrls: ['./periodisk-redovisning-form.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class PeriodiskRedovisningFormComponent {
@Input() periodiskRedovisningFormGroup: FormGroup;
@Input() totalAmountOfSteps: number;
@Input() currentStep: number;
@Output() submitPRFormGroup = new EventEmitter<FormGroup>();
constructor() {}
}

View File

@@ -61,17 +61,17 @@ export class DeltagareSignalArbeteStudierComponent implements OnInit {
private deltagareSignalArbeteStudierService: DeltagareSignalArbeteStudierService,
private deltagareApiService: DeltagareApiService,
private activatedRoute: ActivatedRoute
) { }
) {}
ngOnInit(): void {
this.avrop$ = this.activatedRoute.params.pipe(
switchMap(({ genomforandeReferens }) => this.deltagareApiService.fetchAvropInformation$(genomforandeReferens))
)
);
this.signalArbeteStudierFormGroup = new FormGroup({
ersattningsTyp: new FormControl(null, [RequiredValidator()]),
date: new FormControl(new Date().toLocaleDateString(), [Validators.required]),
percent: new FormControl('', [Validators.min(1), Validators.max(99)])
date: new FormControl(new Date().toLocaleDateString(), [RequiredValidator()]),
percent: new FormControl('', [Validators.min(1), Validators.max(99)]),
});
}
@@ -85,7 +85,8 @@ export class DeltagareSignalArbeteStudierComponent implements OnInit {
antalProcent: +this.percentFormControl.value,
};
this.deltagareSignalArbeteStudierService.createSignalArbeteStudier$(postSignalArbeteStudier)
this.deltagareSignalArbeteStudierService
.createSignalArbeteStudier$(postSignalArbeteStudier)
.then(() => {
this._submittedDate$.next(new Date());
this.signalArbeteStudierFormGroup.reset();
@@ -93,8 +94,7 @@ export class DeltagareSignalArbeteStudierComponent implements OnInit {
})
.catch((error: Error) => {
this._error$.next(new CustomError({ error, message: error.message, type: ErrorType.API }));
})
});
}
}
@@ -118,8 +118,10 @@ export class DeltagareSignalArbeteStudierComponent implements OnInit {
}
get partTimeIsSelected(): boolean {
return +this.ersattningsTypFormControl.value === ErsattningsGrundTypKod.ARBETE_DELTID ||
+this.ersattningsTypFormControl.value === ErsattningsGrundTypKod.UTBILDNING_DELTID;
return (
+this.ersattningsTypFormControl.value === ErsattningsGrundTypKod.ARBETE_DELTID ||
+this.ersattningsTypFormControl.value === ErsattningsGrundTypKod.UTBILDNING_DELTID
);
}
setMinDate(startdatumAvrop: Date): Date {

View File

@@ -4,6 +4,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { LayoutComponent } from '@msfa-shared/components/layout/layout.component';
import { FranvaroReportComponent } from './franvaro-report.component';
import { FranvaroReportService } from './franvaro-report.service';
describe('FranvaroReportComponent', () => {
let component: FranvaroReportComponent;
@@ -14,6 +15,7 @@ describe('FranvaroReportComponent', () => {
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [FranvaroReportComponent, LayoutComponent],
imports: [RouterTestingModule, HttpClientTestingModule],
providers: [FranvaroReportService],
}).compileComponents();
});