diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts index 8b3c3a1de2..2f0993c40f 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts @@ -379,7 +379,29 @@ describe('AttachFileCloudWidgetComponent', () => { expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-root-', 'single', true); }); - it('Should be able to set default alias as rootNodeId if destinationFolderPath contains wrong alias', async () => { + it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath contains wrong alias and single upload for Alfresco Content + Locale', async () => { + widget.field = new FormFieldModel(new FormModel(), { + type: FormFieldTypes.UPLOAD, + value: [] + }); + widget.field.id = 'attach-file-alfresco'; + widget.field.params = allSourceWithWrongAliasParams; + widget.field.params.multiple = false; + fixture.detectChanges(); + await fixture.whenStable(); + const attachButton: HTMLButtonElement = element.querySelector('#attach-file-alfresco'); + + expect(attachButton).not.toBeNull(); + + attachButton.click(); + await fixture.whenStable(); + fixture.detectChanges(); + + expect(widget.rootNodeId).toEqual('-my-'); + expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'single', true); + }); + + it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath contains wrong alias and multiple upload for Alfresco Content + Locale', async () => { widget.field = new FormFieldModel(new FormModel(), { type: FormFieldTypes.UPLOAD, value: [] @@ -401,7 +423,7 @@ describe('AttachFileCloudWidgetComponent', () => { expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'multiple', true); }); - it('Should be able to set default alias as rootNodeId if destinationFolderPath does not have alias', async () => { + it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath does not have alias for Alfresco Content + Locale', async () => { widget.field = new FormFieldModel(new FormModel(), { type: FormFieldTypes.UPLOAD, value: [] @@ -439,8 +461,7 @@ describe('AttachFileCloudWidgetComponent', () => { }); describe('FilesSource', () => { - - it('should be able to set myFiles folderId as rootNodeId if fileSource set only to content', async () => { + it('Should set default user alias (-my-) as rootNodeId if fileSource set only to Alfresco Content', async () => { widget.field = new FormFieldModel(new FormModel(), { type: FormFieldTypes.UPLOAD, value: [] @@ -461,28 +482,6 @@ describe('AttachFileCloudWidgetComponent', () => { expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'single', false); }); - it('should be able to set root folderId as rootNodeId if fileSource set to content and local', async () => { - widget.field = new FormFieldModel(new FormModel(), { - type: FormFieldTypes.UPLOAD, - value: [] - }); - widget.field.id = 'attach-file-alfresco'; - widget.field.params = allSourceWithWrongAliasParams; - widget.field.params.multiple = false; - fixture.detectChanges(); - await fixture.whenStable(); - const attachButton: HTMLButtonElement = element.querySelector('#attach-file-alfresco'); - - expect(attachButton).not.toBeNull(); - - attachButton.click(); - await fixture.whenStable(); - fixture.detectChanges(); - - expect(widget.rootNodeId).toEqual('-my-'); - expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'single', true); - }); - it('should display tooltip when tooltip is set', async(() => { widget.field = new FormFieldModel(new FormModel(), { id: 'attach-file-attach', diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.ts b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.ts index 7c7732d267..37ebafbfd1 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.ts @@ -54,9 +54,13 @@ import { DestinationFolderPathModel } from '../../../models/form-cloud-represent }) export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent implements OnInit { + static ALIAS_ROOT_FOLDER = '-root-'; static ALIAS_USER_FOLDER = '-my-'; static APP_NAME = '-appname-'; - static VALID_ALIAS = ['-root-', AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER, '-shared-']; + static VALID_ALIAS = [ + AttachFileCloudWidgetComponent.ALIAS_ROOT_FOLDER, + AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER, '-shared-' + ]; static RETRIEVE_METADATA_OPTION = 'retrieveMetadata'; typeId = 'AttachFileCloudWidgetComponent';