Fix Start Process button for processes without a start form (#1391)

Refs #1390
This commit is contained in:
Will Abson 2017-01-05 09:54:54 +00:00 committed by Denys Vuika
parent f89fe8e50a
commit 560d1bcd7f
2 changed files with 8 additions and 5 deletions

View File

@ -231,6 +231,8 @@ describe('ActivitiStartProcessInstance', () => {
beforeEach(async(() => { beforeEach(async(() => {
component.name = 'My new process'; component.name = 'My new process';
let change = new SimpleChange(null, '123');
component.ngOnChanges({ 'appId': change });
fixture.detectChanges(); fixture.detectChanges();
component.onProcessDefChange('my:process1'); component.onProcessDefChange('my:process1');
fixture.whenStable(); fixture.whenStable();
@ -243,14 +245,15 @@ describe('ActivitiStartProcessInstance', () => {
expect(startBtn.properties['disabled']).toBe(true); 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(''); component.onProcessDefChange('');
fixture.detectChanges(); fixture.detectChanges();
expect(startBtn.properties['disabled']).toBe(true); 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(); fixture.detectChanges();
startBtn = debugElement.query(By.css('[data-automation-id="btn-start"]'));
expect(startBtn.properties['disabled']).toBe(false); expect(startBtn.properties['disabled']).toBe(false);
})); }));

View File

@ -115,10 +115,10 @@ export class ActivitiStartProcessInstance implements OnChanges {
} }
isStartFormMissingOrValid() { isStartFormMissingOrValid() {
if (this.startForm && this.startForm.form && this.startForm.form.isValid) { if (this.startForm) {
return !this.startForm || this.startForm.form.isValid; return this.startForm.form && this.startForm.form.isValid;
} else { } else {
return false; return true;
} }
} }