Skip to content

Commit

Permalink
[AAE-8556] Update attach file dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktord2000 committed Nov 23, 2023
1 parent 883ff39 commit 7685690
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ describe('AttachFileWidgetDialogComponent', () => {
actionName: 'Choose',
currentFolderId: '-my-',
selected: new EventEmitter<any>(),
ecmHost: 'http://fakeUrl.com'
ecmHost: 'http://fakeUrl.com',
isSelectionValid: (entry: Node) => entry.isFile
};
let element: HTMLInputElement;
let basicAlfrescoAuthService: BasicAlfrescoAuthService;
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit 7685690

Please sign in to comment.