mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
AAE-21573 Add display mode support for porcess start event form (#10273)
This commit is contained in:
parent
0e085bc73a
commit
35f24fddb5
@ -77,6 +77,7 @@
|
||||
[appVersion]="processDefinitionCurrent.appVersion"
|
||||
[data]="resolvedValues"
|
||||
[formId]="processDefinitionCurrent.formKey"
|
||||
[displayModeConfigurations]="displayModeConfigurations"
|
||||
[fieldValidators]="fieldValidators"
|
||||
[showSaveButton]="false"
|
||||
[showCompleteButton]="false"
|
||||
|
@ -56,6 +56,7 @@ import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatAutocompleteHarness } from '@angular/material/autocomplete/testing';
|
||||
import { MatButtonHarness } from '@angular/material/button/testing';
|
||||
import { FormCloudDisplayMode } from '../../../services/form-fields.interfaces';
|
||||
|
||||
describe('StartProcessCloudComponent', () => {
|
||||
let loader: HarnessLoader;
|
||||
@ -348,6 +349,44 @@ describe('StartProcessCloudComponent', () => {
|
||||
expect(startBtn.disabled).toBe(false);
|
||||
});
|
||||
|
||||
it('should be able to start a process with form full display mode', async () => {
|
||||
component.displayModeConfigurations = [
|
||||
{
|
||||
displayMode: FormCloudDisplayMode.fullScreen,
|
||||
options: {
|
||||
onDisplayModeOn: () => {},
|
||||
onDisplayModeOff: () => {},
|
||||
onCompleteTask: () => {},
|
||||
onSaveTask: () => {},
|
||||
fullscreen: true,
|
||||
displayToolbar: true,
|
||||
displayCloseButton: true,
|
||||
trapFocus: true
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
const fakeStartFormClone = structuredClone(fakeStartForm);
|
||||
|
||||
(fakeStartFormClone.formRepresentation as any).displayMode = FormCloudDisplayMode.fullScreen;
|
||||
|
||||
formDefinitionSpy.and.returnValue(of(fakeStartFormClone));
|
||||
getDefinitionsSpy.and.returnValue(of(fakeSingleProcessDefinition('processwithform')));
|
||||
typeValueInto('[data-automation-id="adf-inplace-input"]', 'My new process with form');
|
||||
typeValueInto('#processDefinitionName', 'processwithform');
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
fixture.detectChanges();
|
||||
const firstNameEl = fixture.nativeElement.querySelector('#firstName');
|
||||
expect(firstNameEl).toBeDefined();
|
||||
const lastNameEl = fixture.nativeElement.querySelector('#lastName');
|
||||
expect(lastNameEl).toBeDefined();
|
||||
const startBtn = fixture.nativeElement.querySelector('#button-start');
|
||||
expect(component.formCloud.isValid).toBe(true);
|
||||
expect(startBtn.disabled).toBe(false);
|
||||
});
|
||||
|
||||
it('should NOT be able to start a process with a form NOT valid', async () => {
|
||||
formDefinitionSpy.and.returnValue(of(fakeStartFormNotValid));
|
||||
getDefinitionsSpy.and.returnValue(of(fakeSingleProcessDefinition('processwithform')));
|
||||
|
@ -42,6 +42,7 @@ import { forkJoin, of, Subject } from 'rxjs';
|
||||
import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model';
|
||||
import { TaskVariableCloud } from '../../../form/models/task-variable-cloud.model';
|
||||
import { ProcessNameCloudPipe } from '../../../pipes/process-name-cloud.pipe';
|
||||
import { FormCloudDisplayModeConfiguration } from '../../../services/form-fields.interfaces';
|
||||
|
||||
const MAX_NAME_LENGTH: number = 255;
|
||||
const PROCESS_DEFINITION_DEBOUNCE: number = 300;
|
||||
@ -96,6 +97,13 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
@Input()
|
||||
showCancelButton: boolean = true;
|
||||
|
||||
/**
|
||||
* The available display configurations for the form.
|
||||
* (start process event can have assigned form)
|
||||
*/
|
||||
@Input()
|
||||
displayModeConfigurations: FormCloudDisplayModeConfiguration[];
|
||||
|
||||
/** Emitted when the process is successfully started. */
|
||||
@Output()
|
||||
success = new EventEmitter<ProcessInstanceCloud>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user