[ACA-4323] Can't add aspects to a folder in ACA/ADW (#2041)

* [ACA-4323] Can't add aspects to a folder in ACA/ADW

* * Added unit tests
This commit is contained in:
siva kumar
2021-03-08 09:33:44 +00:00
committed by GitHub
parent 45f89c005a
commit 5d0d68d0bd
2 changed files with 18 additions and 5 deletions
+16 -3
View File
@@ -472,17 +472,30 @@ describe('NodeEffects', () => {
expect(contentService.manageAspects).toHaveBeenCalled();
});
it('should call aspect dialog from the active selection', fakeAsync(() => {
it('should call aspect dialog from the active file selection', fakeAsync(() => {
spyOn(contentService, 'manageAspects').and.stub();
const node: any = { entry: { isFile: true } };
const node: any = { entry: { isFile: true, id: 'file-node-id' } };
store.dispatch(new SetSelectedNodesAction([node]));
tick(100);
store.dispatch(new ManageAspectsAction(null));
expect(contentService.manageAspects).toHaveBeenCalled();
expect(contentService.manageAspects).toHaveBeenCalledWith({ entry: { isFile: true, id: 'file-node-id' } });
}));
it('should call aspect dialog from the active folder selection', fakeAsync(() => {
spyOn(contentService, 'manageAspects').and.stub();
const node: any = { entry: { isFile: false, id: 'folder-node-id' } };
store.dispatch(new SetSelectedNodesAction([node]));
tick(100);
store.dispatch(new ManageAspectsAction(null));
expect(contentService.manageAspects).toHaveBeenCalledWith({ entry: { isFile: false, id: 'folder-node-id' } });
}));
});
});
+2 -2
View File
@@ -328,8 +328,8 @@ export class NodeEffects {
.select(getAppSelection)
.pipe(take(1))
.subscribe((selection) => {
if (selection && selection.file) {
this.contentService.manageAspects(selection.file);
if (selection && !selection.isEmpty) {
this.contentService.manageAspects(selection.nodes[0]);
}
});
}