[AAE-3219] Start process button is disabled when page is first displayed (#5955)

This commit is contained in:
Mercy Chrysolite
2020-08-06 01:24:57 +05:30
committed by GitHub
parent 5e19d488ce
commit 700c06521b
2 changed files with 24 additions and 1 deletions

View File

@@ -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', () => {

View File

@@ -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()),