mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-2824: Managed to trigger executeOutcome when clicking on custom outcome buttons (#7873)
This commit is contained in:
@@ -480,7 +480,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
const result = formComponent.onOutcomeClicked(outcome);
|
||||
expect(result).toBeTruthy();
|
||||
expect(saved).toBeTruthy();
|
||||
expect(saved).toBeFalse();
|
||||
expect(formComponent.completeTaskForm).toHaveBeenCalledWith(outcomeName);
|
||||
});
|
||||
|
||||
|
@@ -14,7 +14,8 @@
|
||||
(formCompleted)="onFormCompleted($event)"
|
||||
(formError)="onError($event)"
|
||||
(error)="onError($event)"
|
||||
(formContentClicked)="onFormContentClicked($event)">
|
||||
(formContentClicked)="onFormContentClicked($event)"
|
||||
(executeOutcome)="onFormExecuteOutcome($event)">
|
||||
<adf-cloud-form-custom-outcomes>
|
||||
<ng-template [ngTemplateOutlet]="taskFormCloudButtons">
|
||||
</ng-template>
|
||||
|
@@ -19,7 +19,7 @@ import { DebugElement, SimpleChange } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { of } from 'rxjs';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { FormModel, FormOutcomeEvent, FormOutcomeModel, setupTestBed } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { TaskFormCloudComponent } from './task-form-cloud.component';
|
||||
import {
|
||||
@@ -400,6 +400,14 @@ describe('TaskFormCloudComponent', () => {
|
||||
|
||||
expect(loadingTemplate).toBeNull();
|
||||
});
|
||||
|
||||
it('should emit an executeOutcome event when form outcome executed', () => {
|
||||
const executeOutcomeSpy: jasmine.Spy = spyOn(component.executeOutcome, 'emit');
|
||||
|
||||
component.onFormExecuteOutcome(new FormOutcomeEvent(new FormOutcomeModel(new FormModel())));
|
||||
|
||||
expect(executeOutcomeSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it('should display task name as title on no form template if showTitle is true', () => {
|
||||
|
@@ -21,7 +21,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { TaskDetailsCloudModel } from '../../start-task/models/task-details-cloud.model';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
import { FormRenderingService, FormModel, ContentLinkModel } from '@alfresco/adf-core';
|
||||
import { FormRenderingService, FormModel, ContentLinkModel, FormOutcomeEvent } from '@alfresco/adf-core';
|
||||
import { AttachFileCloudWidgetComponent } from '../../../form/components/widgets/attach-file/attach-file-cloud-widget.component';
|
||||
import { DropdownCloudWidgetComponent } from '../../../form/components/widgets/dropdown/dropdown-cloud.widget';
|
||||
import { DateCloudWidgetComponent } from '../../../form/components/widgets/date/date-cloud.widget';
|
||||
@@ -98,6 +98,12 @@ export class TaskFormCloudComponent implements OnInit, OnChanges {
|
||||
@Output()
|
||||
formContentClicked: EventEmitter<ContentLinkModel> = new EventEmitter();
|
||||
|
||||
/** Emitted when any outcome is executed. Default behaviour can be prevented
|
||||
* via `event.preventDefault()`.
|
||||
*/
|
||||
@Output()
|
||||
executeOutcome = new EventEmitter<FormOutcomeEvent>();
|
||||
|
||||
taskDetails: TaskDetailsCloudModel;
|
||||
|
||||
candidateUsers: string[] = [];
|
||||
@@ -219,4 +225,8 @@ export class TaskFormCloudComponent implements OnInit, OnChanges {
|
||||
onFormContentClicked(content: ContentLinkModel) {
|
||||
this.formContentClicked.emit(content);
|
||||
}
|
||||
|
||||
onFormExecuteOutcome(outcome: FormOutcomeEvent) {
|
||||
this.executeOutcome.emit(outcome);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user