From 768569068ae7239c5c906deeff0d3db906bcbf5a Mon Sep 17 00:00:00 2001 From: wiktord2000 Date: Thu, 23 Nov 2023 09:25:17 +0100 Subject: [PATCH] [AAE-8556] Update attach file dialog --- .../attach-file-widget-dialog.component.spec.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts index d7a2270f114..bd8bf24a9da 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts @@ -38,7 +38,8 @@ describe('AttachFileWidgetDialogComponent', () => { actionName: 'Choose', currentFolderId: '-my-', selected: new EventEmitter(), - ecmHost: 'http://fakeUrl.com' + ecmHost: 'http://fakeUrl.com', + isSelectionValid: (entry: Node) => entry.isFile }; let element: HTMLInputElement; let basicAlfrescoAuthService: BasicAlfrescoAuthService; @@ -147,7 +148,7 @@ describe('AttachFileWidgetDialogComponent', () => { expect(element.querySelector('button[data-automation-id="attach-file-dialog-actions-choose"]')).not.toBeNull(); }); - it('should be able to select a file', (done) => { + it('should be able to choose a file', (done) => { data.selected.subscribe((nodeList: Node[]) => { expect(nodeList[0].id).toBe('fake'); expect(nodeList[0].isFile).toBeTruthy(); @@ -162,6 +163,18 @@ describe('AttachFileWidgetDialogComponent', () => { }); }); + it('[C594015] should not be able to choose a folder', () => { + spyOn(widget,'onSelect'); + const fakeFolderNode: Node = new Node({ id: 'fakeFolder', isFile: false, isFolder: true}); + + contentNodePanel.componentInstance.onCurrentSelection([ { entry: fakeFolderNode }]); + fixture.detectChanges(); + + const chooseButton: HTMLButtonElement = element.querySelector('button[data-automation-id="attach-file-dialog-actions-choose"]'); + expect(chooseButton.disabled).toBe(true); + expect(widget.onSelect).toHaveBeenCalledOnceWith([]); + }); + it('should update the title when a site is selected', () => { const fakeSiteTitle = 'My fake site'; contentNodePanel.componentInstance.siteChange.emit(fakeSiteTitle);