From 560d1bcd7f52879c57c2d4bb47cefccea9f012a8 Mon Sep 17 00:00:00 2001 From: Will Abson Date: Thu, 5 Jan 2017 09:54:54 +0000 Subject: [PATCH] Fix Start Process button for processes without a start form (#1391) Refs #1390 --- .../components/activiti-start-process.component.spec.ts | 7 +++++-- .../src/components/activiti-start-process.component.ts | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.spec.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.spec.ts index ac0e534adb..11d01cb2c7 100644 --- a/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.spec.ts +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.spec.ts @@ -231,6 +231,8 @@ describe('ActivitiStartProcessInstance', () => { beforeEach(async(() => { component.name = 'My new process'; + let change = new SimpleChange(null, '123'); + component.ngOnChanges({ 'appId': change }); fixture.detectChanges(); component.onProcessDefChange('my:process1'); fixture.whenStable(); @@ -243,14 +245,15 @@ describe('ActivitiStartProcessInstance', () => { expect(startBtn.properties['disabled']).toBe(true); })); - it('should have start button disabled when name not filled out', async(() => { + it('should have start button disabled when no process is selected', async(() => { component.onProcessDefChange(''); fixture.detectChanges(); expect(startBtn.properties['disabled']).toBe(true); })); - xit('should enable start button when name and process filled out', async(() => { + it('should enable start button when name and process filled out', async(() => { fixture.detectChanges(); + startBtn = debugElement.query(By.css('[data-automation-id="btn-start"]')); expect(startBtn.properties['disabled']).toBe(false); })); 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 04cd99885e..04f600864c 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 @@ -115,10 +115,10 @@ export class ActivitiStartProcessInstance implements OnChanges { } isStartFormMissingOrValid() { - if (this.startForm && this.startForm.form && this.startForm.form.isValid) { - return !this.startForm || this.startForm.form.isValid; + if (this.startForm) { + return this.startForm.form && this.startForm.form.isValid; } else { - return false; + return true; } }