mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ACA-3461] Start Process - show form for preselected process (#5787)
* [ACA-3461] Start Process - show form for preselected process * fix unit test * fix unit test Co-authored-by: Silviu Popa <p3701014@L3700101120.ness.com>
This commit is contained in:
@@ -451,6 +451,27 @@ describe('StartProcessCloudComponent', () => {
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should select automatically the form when processDefinition is selected as default', fakeAsync(() => {
|
||||||
|
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(of([fakeProcessDefinitions[0]]));
|
||||||
|
formDefinitionSpy = spyOn(formCloudService, 'getForm').and.returnValue(of(fakeStartForm));
|
||||||
|
const change = new SimpleChange('myApp', 'myApp1', true);
|
||||||
|
component.ngOnInit();
|
||||||
|
component.ngOnChanges({ appName: change });
|
||||||
|
component.processForm.controls['processDefinition'].setValue('process');
|
||||||
|
fixture.detectChanges();
|
||||||
|
tick(3000);
|
||||||
|
component.processDefinitionName = fakeProcessDefinitions[0].name;
|
||||||
|
component.setProcessDefinitionOnForm(fakeProcessDefinitions[0].name);
|
||||||
|
fixture.detectChanges();
|
||||||
|
tick(3000);
|
||||||
|
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
const processForm = fixture.nativeElement.querySelector('adf-cloud-form');
|
||||||
|
expect(component.hasForm()).toBeTruthy();
|
||||||
|
expect(processForm).not.toBeNull();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
it('should not select automatically any processDefinition if the app contain multiple process and does not have any processDefinition as input', async(() => {
|
it('should not select automatically any processDefinition if the app contain multiple process and does not have any processDefinition as input', async(() => {
|
||||||
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(of(fakeProcessDefinitions));
|
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(of(fakeProcessDefinitions));
|
||||||
component.appName = 'myApp';
|
component.appName = 'myApp';
|
||||||
|
@@ -226,6 +226,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
|||||||
const selectedProcess = this.getProcessDefinitionByName(this.processDefinitionName);
|
const selectedProcess = this.getProcessDefinitionByName(this.processDefinitionName);
|
||||||
if (selectedProcess) {
|
if (selectedProcess) {
|
||||||
this.processDefinition.setValue(selectedProcess.name);
|
this.processDefinition.setValue(selectedProcess.name);
|
||||||
|
this.processDefinitionSelectionChanged(selectedProcess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ export let fakeProcessDefinitions: ProcessDefinitionCloud[] = [
|
|||||||
id: 'NewProcess:1',
|
id: 'NewProcess:1',
|
||||||
name: 'processwithoutform1',
|
name: 'processwithoutform1',
|
||||||
key: 'process-12345-f992-4ee6-9742-3a04617469fe',
|
key: 'process-12345-f992-4ee6-9742-3a04617469fe',
|
||||||
formKey: ''
|
formKey: 'mockFormKey'
|
||||||
}),
|
}),
|
||||||
new ProcessDefinitionCloud({
|
new ProcessDefinitionCloud({
|
||||||
appName: 'myApp',
|
appName: 'myApp',
|
||||||
|
Reference in New Issue
Block a user