mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-8561] [Modeling] The 'value' of string var in destinat… (#7722)
* [ci:force][AAE-8561] [Modeling] The 'value' of string var in destinationFolderPath is not always visible in JSON Editor * UPdated UT
This commit is contained in:
@@ -103,7 +103,7 @@ export class FormModel implements ProcessFormModel {
|
|||||||
this.customFieldTemplates = json.customFieldTemplates || {};
|
this.customFieldTemplates = json.customFieldTemplates || {};
|
||||||
this.selectedOutcome = json.selectedOutcome;
|
this.selectedOutcome = json.selectedOutcome;
|
||||||
this.className = json.className || '';
|
this.className = json.className || '';
|
||||||
this.variables = json.variables || [];
|
this.variables = json.variables || json.formDefinition?.variables || [];
|
||||||
this.processVariables = json.processVariables || [];
|
this.processVariables = json.processVariables || [];
|
||||||
this.enableFixedSpace = enableFixedSpace ? true : false;
|
this.enableFixedSpace = enableFixedSpace ? true : false;
|
||||||
this.confirmMessage = json.confirmMessage || {};
|
this.confirmMessage = json.confirmMessage || {};
|
||||||
|
@@ -302,7 +302,8 @@ describe('AttachFileCloudWidgetComponent', () => {
|
|||||||
it('should be able to use mapped string variable value if the destinationFolderPath set to string type variable', async () => {
|
it('should be able to use mapped string variable value if the destinationFolderPath set to string type variable', async () => {
|
||||||
const getNodeIdFromPathSpy = spyOn(contentCloudNodeSelectorService, 'getNodeIdFromPath').and.returnValue(mockNodeIdBasedOnStringVariableValue);
|
const getNodeIdFromPathSpy = spyOn(contentCloudNodeSelectorService, 'getNodeIdFromPath').and.returnValue(mockNodeIdBasedOnStringVariableValue);
|
||||||
|
|
||||||
const form = new FormModel({ formVariables, processVariables });
|
const variables = formVariables;
|
||||||
|
const form = new FormModel({ variables, formVariables, processVariables });
|
||||||
createUploadWidgetField(form, 'attach-file-alfresco', [], mockAllFileSourceWithStringVariablePathType);
|
createUploadWidgetField(form, 'attach-file-alfresco', [], mockAllFileSourceWithStringVariablePathType);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
@@ -787,8 +788,10 @@ describe('AttachFileCloudWidgetComponent', () => {
|
|||||||
|
|
||||||
describe('Upload widget with destination folder path params', () => {
|
describe('Upload widget with destination folder path params', () => {
|
||||||
let form: FormModel;
|
let form: FormModel;
|
||||||
|
const variables = formVariables;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
form = new FormModel({
|
form = new FormModel({
|
||||||
|
variables,
|
||||||
formVariables,
|
formVariables,
|
||||||
processVariables
|
processVariables
|
||||||
});
|
});
|
||||||
@@ -810,14 +813,6 @@ describe('AttachFileCloudWidgetComponent', () => {
|
|||||||
expect(widget.field.params.fileSource.destinationFolderPath.value).toBe('mock-folder-id');
|
expect(widget.field.params.fileSource.destinationFolderPath.value).toBe('mock-folder-id');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('it should get a destination folder path value from a folder variable', () => {
|
|
||||||
createUploadWidgetField(form, 'attach-file-attach', [], mockAllFileSourceWithFolderVariablePathType);
|
|
||||||
fixture.detectChanges();
|
|
||||||
|
|
||||||
expect(widget.field.params.fileSource.destinationFolderPath.type).toBe('folder');
|
|
||||||
expect(widget.field.params.fileSource.destinationFolderPath.value).toBe('mock-folder-id');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('it should set destination folder path value to undefined if mapped variable deleted/renamed', () => {
|
it('it should set destination folder path value to undefined if mapped variable deleted/renamed', () => {
|
||||||
createUploadWidgetField(form, 'attach-file-attach', [], mockAllFileSourceWithRenamedFolderVariablePathType);
|
createUploadWidgetField(form, 'attach-file-attach', [], mockAllFileSourceWithRenamedFolderVariablePathType);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@@ -204,6 +204,6 @@ export class UploadCloudWidgetComponent extends WidgetComponent implements OnIni
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getDestinationFolderPathValue(): any {
|
private getDestinationFolderPathValue(): any {
|
||||||
return this.field.form.getProcessVariableValue(this.field.params.fileSource?.destinationFolderPath?.name);
|
return this.field.form.getFormVariableValue(this.field.params.fileSource?.destinationFolderPath?.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -397,12 +397,13 @@ export const formVariables = [
|
|||||||
id: 'bfca9766-7bc1-45cc-8ecf-cdad551e36e2',
|
id: 'bfca9766-7bc1-45cc-8ecf-cdad551e36e2',
|
||||||
name: 'name1',
|
name: 'name1',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
value: 'hello'
|
value: '-root-/pathBasedOnStringvariablevalue'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '3ed9f28a-dbae-463f-b991-47ef06658bb6',
|
id: '3ed9f28a-dbae-463f-b991-47ef06658bb6',
|
||||||
name: 'name2',
|
name: 'name2',
|
||||||
type: 'folder'
|
type: 'folder',
|
||||||
|
value: [{ id: 'mock-folder-id'}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'booleanVar',
|
id: 'booleanVar',
|
||||||
|
Reference in New Issue
Block a user