[ADF-1175] Start Process and Start Task Forms don't close when Cancel button is clicked (#2133)

* [ADF-1175] Start Process and Start Task Forms don't close when Cancel button is clicked.

* Added Start task/process cancel emitter handler to redirect when user clicks on cancel start/process .

* [ADF-1175] Start Process and Start Task Forms don't close when Cancel button is clicked.

* Changed activiti-start-task to adf-start-task
* Changed onSuccess to success and Updated     document.

* [ADF-1175] Start Process and Start Task Forms don't close when Cancel button is clicked

* Refactored  start task component unit testcases
This commit is contained in:
siva kumar
2017-07-27 14:24:35 +05:30
committed by Eugenio Romano
parent 32e64339ee
commit ddc32328d8
5 changed files with 33 additions and 18 deletions

View File

@@ -514,7 +514,7 @@ This component Creates/Starts new task for the specified app
| Name | Description |
| --- | --- |
| onSuccess | Raised when the task is successfully created |
| success | Raised when the task is successfully created |
| cancel | Raised when the cancel button is pressed by the user |
| error | Raised if there is an error during task creation |

View File

@@ -133,7 +133,7 @@ describe('StartTaskComponent', () => {
});
it('should create new task when start is clicked', async(() => {
activitiStartTaskComponent.onSuccess.subscribe((res) => {
activitiStartTaskComponent.success.subscribe((res) => {
expect(res).toBeDefined();
});
activitiStartTaskComponent.appId = 'fakeAppId';
@@ -144,8 +144,8 @@ describe('StartTaskComponent', () => {
});
}));
it('should send on onSuccess event when the task is started', async(() => {
activitiStartTaskComponent.onSuccess.subscribe((res) => {
it('should send on success event when the task is started', async(() => {
activitiStartTaskComponent.success.subscribe((res) => {
expect(res).toBeDefined();
expect(res.id).toBe(91);
expect(res.name).toBe('fakeName');
@@ -175,8 +175,8 @@ describe('StartTaskComponent', () => {
});
}));
it('should send on onSuccess event when only name is given', async(() => {
activitiStartTaskComponent.onSuccess.subscribe((res) => {
it('should send on success event when only name is given', async(() => {
activitiStartTaskComponent.success.subscribe((res) => {
expect(res).toBeDefined();
});
activitiStartTaskComponent.appId = 'fakeAppId';
@@ -191,7 +191,7 @@ describe('StartTaskComponent', () => {
}));
it('should attach a task when a form id selected', () => {
activitiStartTaskComponent.onSuccess.subscribe((res) => {
activitiStartTaskComponent.success.subscribe((res) => {
expect(res).toBeDefined();
expect(res.formKey).toBe('4');
});
@@ -201,13 +201,13 @@ describe('StartTaskComponent', () => {
expect(getcreateNewTaskSpy).toHaveBeenCalled();
});
it('should not emit onSuccess event when data not present', async(() => {
let onSuccessSpy: jasmine.Spy = spyOn(activitiStartTaskComponent.onSuccess, 'emit');
it('should not emit success event when data not present', async(() => {
let successSpy: jasmine.Spy = spyOn(activitiStartTaskComponent.success, 'emit');
activitiStartTaskComponent.startTaskmodel = new StartTaskModel(null);
activitiStartTaskComponent.start();
fixture.detectChanges();
expect(getcreateNewTaskSpy).not.toHaveBeenCalled();
expect(onSuccessSpy).not.toHaveBeenCalled();
expect(successSpy).not.toHaveBeenCalled();
}));
});

View File

@@ -35,7 +35,7 @@ export class StartTaskComponent implements OnInit {
appId: string;
@Output()
onSuccess: EventEmitter<any> = new EventEmitter<any>();
success: EventEmitter<any> = new EventEmitter<any>();
@Output()
cancel: EventEmitter<void> = new EventEmitter<void>();
@@ -75,7 +75,7 @@ export class StartTaskComponent implements OnInit {
this.startTaskmodel.category = this.appId;
this.taskService.createNewTask(new TaskDetailsModel(this.startTaskmodel)).subscribe(
(res: any) => {
this.onSuccess.emit(res);
this.success.emit(res);
this.attachForm(res.id);
this.resetForm();
},