Skip to content
Snippets Groups Projects
Commit 20cfb52c authored by Giuseppe Digilio's avatar Giuseppe Digilio
Browse files

Fixed issue with init license section status

parent c73b4c71
No related branches found
No related tags found
No related merge requests found
......@@ -280,11 +280,11 @@ describe('LicenseSectionComponent test suite', () => {
fixture.detectChanges();
const model = formBuilderService.findById('granted', comp.formModel);
(model as DynamicCheckboxModel).valueUpdates.next(true);
compAsAny.getSectionStatus().subscribe((status) => {
expect(status).toBeTruthy();
});
(model as DynamicCheckboxModel).valueUpdates.next(true);
});
it('should have status false when checkbox is not selected', () => {
......
import { ChangeDetectorRef, Component, Inject, ViewChild } from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { distinctUntilChanged, filter, find, flatMap, map, startWith, take } from 'rxjs/operators';
import { distinctUntilChanged, filter, find, flatMap, map, startWith, take, tap } from 'rxjs/operators';
import {
DynamicCheckboxModel,
DynamicFormControlEvent,
......@@ -87,8 +87,7 @@ export class LicenseSectionComponent extends SectionModelComponent {
this.sectionService.isSectionReadOnly(
this.submissionId,
this.sectionData.id,
this.submissionService.getSubmissionScope()
).pipe(
this.submissionService.getSubmissionScope()).pipe(
take(1),
filter((isReadOnly) => isReadOnly))
.subscribe(() => {
......@@ -130,7 +129,8 @@ export class LicenseSectionComponent extends SectionModelComponent {
protected getSectionStatus(): Observable<boolean> {
const model = this.formBuilderService.findById('granted', this.formModel);
return (model as DynamicCheckboxModel).valueUpdates.pipe(
map((value) => value === true));
map((value) => value === true),
startWith((model as DynamicCheckboxModel).value));
}
onChange(event: DynamicFormControlEvent) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment