diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.html b/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.html
index 22d51186c5..c506e6f7f9 100644
--- a/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.html
+++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.html
@@ -4,7 +4,7 @@
-
-
{
it('should call service to start process if required fields provided', (done) => {
component.name = 'My new process';
- component.processDefinitionId = 'my:process1';
component.showDialog();
fixture.detectChanges();
+ component.onChange('my:process1');
component.startProcess();
fixture.whenStable().then(() => {
expect(startProcessSpy).toHaveBeenCalled();
@@ -120,9 +120,9 @@ describe('ActivitiStartProcessButton', () => {
it('should call service to start process with the correct parameters', (done) => {
component.name = 'My new process';
- component.processDefinitionId = 'my:process1';
component.showDialog();
fixture.detectChanges();
+ component.onChange('my:process1');
component.startProcess();
fixture.whenStable().then(() => {
expect(startProcessSpy).toHaveBeenCalledWith('my:process1', 'My new process', undefined);
@@ -133,9 +133,9 @@ describe('ActivitiStartProcessButton', () => {
it('should output start event when process started successfully', (done) => {
let emitSpy = spyOn(component.start, 'emit');
component.name = 'My new process';
- component.processDefinitionId = 'my:process1';
component.showDialog();
fixture.detectChanges();
+ component.onChange('my:process1');
component.startProcess();
fixture.whenStable().then(() => {
expect(emitSpy).toHaveBeenCalledWith(newProcess);
@@ -145,9 +145,9 @@ describe('ActivitiStartProcessButton', () => {
it('should indicate start form is missing when process does not have a start form', (done) => {
component.name = 'My new process';
- component.processDefinitionId = 'my:process1';
component.showDialog();
fixture.detectChanges();
+ component.onChange('my:process1');
component.startProcess();
fixture.whenStable().then(() => {
expect(component.isStartFormMissingOrValid()).toBe(true);
diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.ts
index 9f6edfc120..c3e05ca67d 100644
--- a/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.ts
+++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.ts
@@ -46,7 +46,6 @@ export class ActivitiStartProcessButton implements OnInit, OnChanges {
processDefinitions: any[] = [];
name: string;
- processDefinitionId: string;
currentProcessDef: any;
@@ -90,12 +89,11 @@ export class ActivitiStartProcessButton implements OnInit, OnChanges {
}
public startProcess() {
- if (this.processDefinitionId && this.name) {
+ if (this.currentProcessDef.id && this.name) {
let formValues = this.startForm ? this.startForm.form.values : undefined;
- this.activitiProcess.startProcess(this.processDefinitionId, this.name, formValues).subscribe(
+ this.activitiProcess.startProcess(this.currentProcessDef.id, this.name, formValues).subscribe(
(res: any) => {
this.name = '';
- this.processDefinitionId = '';
this.start.emit(res);
this.cancel();
},
@@ -125,11 +123,10 @@ export class ActivitiStartProcessButton implements OnInit, OnChanges {
}
validateForm() {
- return this.processDefinitionId && this.name && this.isStartFormMissingOrValid();
+ return this.currentProcessDef.id && this.name && this.isStartFormMissingOrValid();
}
reset() {
- this.processDefinitionId = undefined;
- this.currentProcessDef = undefined;
+ this.currentProcessDef = {};
}
}