Skip to content

Commit

Permalink
[ACS-6583] fix flickering toolbar on folder upload (#3609)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-web-ua authored Jan 26, 2024
1 parent f628892 commit c9dc3ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ describe('FilesComponent', () => {
expect(component.reload).toHaveBeenCalled();
}));

it('should not call reload on fileUploadComplete event if file parent folder already displayed', fakeAsync(() => {
spyOn(component.documentList.data, 'getRows').and.returnValue([{ node: { entry: { isFolder: true, name: 'files' } } }] as any);
const file: any = { file: { options: { parentId: 'parentId', path: '/files' } } };
component.node = { id: 'parentId' } as any;

uploadService.fileUploadComplete.next(file);

tick(500);

expect(component.reload).not.toHaveBeenCalled();
}));

it('should not call refresh on fileUploadComplete event if parent mismatch', fakeAsync(() => {
const file: any = { file: { options: { parentId: 'otherId' } } };
component.node = { id: 'parentId' } as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
}

displayFolderParent(index: number, filePath = '') {
const parentName = filePath.split('/')[index];
const parentName = filePath.split('/').filter((el) => el)[index];
const currentFoldersDisplayed = (this.documentList.data.getRows() as ShareDataRow[]) || [];

const alreadyDisplayedParentFolder = currentFoldersDisplayed.find((row) => row.node.entry.isFolder && row.node.entry.name === parentName);
Expand Down

0 comments on commit c9dc3ce

Please sign in to comment.