From 700c06521b0b7f8797c275e88e9a3051376a13c2 Mon Sep 17 00:00:00 2001 From: Mercy Chrysolite <48274621+mcchrys@users.noreply.github.com> Date: Thu, 6 Aug 2020 01:24:57 +0530 Subject: [PATCH] [AAE-3219] Start process button is disabled when page is first displayed (#5955) --- .../start-process-cloud.component.spec.ts | 23 +++++++++++++++++++ .../start-process-cloud.component.ts | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.spec.ts index 8f118edc076..d5375ef5f9b 100755 --- a/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.spec.ts @@ -360,6 +360,29 @@ describe('StartProcessCloudComponent', () => { expect(component.currentCreatedProcess.startDate).toBeNull(); }); })); + + it('should have start button enabled when default values are set', fakeAsync(() => { + component.values = [{ 'name': 'firstName', 'value': 'FakeName' }, { + 'name': 'lastName', + 'value': 'FakeLastName' + }]; + component.name = 'testFormWithProcess'; + component.processDefinitionName = 'processwithoutform2'; + getDefinitionsSpy.and.returnValue(of(fakeSingleProcessDefinition(component.processDefinitionName))); + fixture.detectChanges(); + formDefinitionSpy = spyOn(formCloudService, 'getForm').and.returnValue(of(fakeStartForm)); + + const change = new SimpleChange(null, 'MyApp', true); + component.ngOnChanges({ 'appName': change }); + fixture.detectChanges(); + tick(450); + + fixture.whenStable().then(() => { + fixture.detectChanges(); + const startBtn = fixture.nativeElement.querySelector('#button-start'); + expect(startBtn.disabled).toBe(false); + }); + })); }); describe('process definitions list', () => { diff --git a/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.ts b/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.ts index acf62c1c186..c309495bb47 100755 --- a/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.ts @@ -126,7 +126,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy this.processForm.valueChanges .pipe( - debounceTime(200), + debounceTime(400), tap(() => this.disableStartButton = true), distinctUntilChanged(), filter(() => this.isProcessSelectionValid()),