mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -212,6 +212,8 @@ describe('ActivitiStartProcessButton', () => {
|
|||||||
|
|
||||||
describe('start forms', () => {
|
describe('start forms', () => {
|
||||||
|
|
||||||
|
let startBtn;
|
||||||
|
|
||||||
describe('without start form', () => {
|
describe('without start form', () => {
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
@@ -220,15 +222,23 @@ describe('ActivitiStartProcessButton', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
component.onProcessDefChange('my:process1');
|
component.onProcessDefChange('my:process1');
|
||||||
fixture.whenStable();
|
fixture.whenStable();
|
||||||
|
startBtn = debugElement.query(By.css('[data-automation-id="btn-start"]'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should indicate start form is missing', async(() => {
|
it('should have start button disabled when name not filled out', async(() => {
|
||||||
expect(component.isStartFormMissingOrValid()).toBe(true);
|
component.name = '';
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(startBtn.properties['disabled']).toBe(true);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should have start button disabled when name not filled out', async(() => {
|
||||||
|
component.onProcessDefChange('');
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(startBtn.properties['disabled']).toBe(true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('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();
|
||||||
let startBtn = debugElement.query(By.css('[data-automation-id="btn-start"]'));
|
|
||||||
expect(startBtn.properties['disabled']).toBe(false);
|
expect(startBtn.properties['disabled']).toBe(false);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -243,6 +253,7 @@ describe('ActivitiStartProcessButton', () => {
|
|||||||
component.onProcessDefChange('my:process1');
|
component.onProcessDefChange('my:process1');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable();
|
fixture.whenStable();
|
||||||
|
startBtn = debugElement.query(By.css('[data-automation-id="btn-start"]'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should initialize start form', () => {
|
it('should initialize start form', () => {
|
||||||
@@ -254,14 +265,9 @@ describe('ActivitiStartProcessButton', () => {
|
|||||||
expect(getStartFormDefinitionSpy).toHaveBeenCalled();
|
expect(getStartFormDefinitionSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should indicate start form is invalid', async(() => {
|
|
||||||
expect(component.isStartFormMissingOrValid()).toBe(false);
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should leave start button disabled when mandatory fields not filled out', async(() => {
|
it('should leave start button disabled when mandatory fields not filled out', async(() => {
|
||||||
component.name = 'My new process';
|
component.name = 'My new process';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
let startBtn = debugElement.query(By.css('[data-automation-id="btn-start"]'));
|
|
||||||
expect(startBtn.properties['disabled']).toBe(true);
|
expect(startBtn.properties['disabled']).toBe(true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -120,8 +120,11 @@ export class ActivitiStartProcessButton implements OnInit, OnChanges {
|
|||||||
let processDef = this.processDefinitions.find((processDefinition) => {
|
let processDef = this.processDefinitions.find((processDefinition) => {
|
||||||
return processDefinition.id === processDefinitionId;
|
return processDefinition.id === processDefinitionId;
|
||||||
});
|
});
|
||||||
let clone = JSON.parse(JSON.stringify(processDef));
|
if (processDef) {
|
||||||
this.currentProcessDef = clone;
|
this.currentProcessDef = JSON.parse(JSON.stringify(processDef));
|
||||||
|
} else {
|
||||||
|
this.resetSelectedProcessDefinition();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hasStartForm() {
|
hasStartForm() {
|
||||||
|
Reference in New Issue
Block a user