mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
download shared nodes (#3229)
This commit is contained in:
committed by
Eugenio Romano
parent
1f72317e93
commit
3bc419e128
@@ -95,6 +95,17 @@ describe('NodeDownloadDirective', () => {
|
|||||||
expect(contentService.getContentUrl).toHaveBeenCalledWith(node.entry.id, true);
|
expect(contentService.getContentUrl).toHaveBeenCalledWith(node.entry.id, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should download selected shared node as file', () => {
|
||||||
|
spyOn(contentService, 'getContentUrl');
|
||||||
|
const node = { entry: { nodeId: 'shared-node-id', isFile: true } };
|
||||||
|
component.selection = [node];
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
element.triggerEventHandler('click', null);
|
||||||
|
|
||||||
|
expect(contentService.getContentUrl).toHaveBeenCalledWith(node.entry.nodeId, true);
|
||||||
|
});
|
||||||
|
|
||||||
it('should download selected files nodes as zip', () => {
|
it('should download selected files nodes as zip', () => {
|
||||||
const node1 = { entry: { id: 'node-1' } };
|
const node1 = { entry: { id: 'node-1' } };
|
||||||
const node2 = { entry: { id: 'node-2' } };
|
const node2 = { entry: { id: 'node-2' } };
|
||||||
@@ -106,6 +117,17 @@ describe('NodeDownloadDirective', () => {
|
|||||||
expect(dialogSpy.calls.argsFor(0)[1].data).toEqual({ nodeIds: [ 'node-1', 'node-2' ] });
|
expect(dialogSpy.calls.argsFor(0)[1].data).toEqual({ nodeIds: [ 'node-1', 'node-2' ] });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should download selected shared files nodes as zip', () => {
|
||||||
|
const node1 = { entry: { nodeId: 'shared-node-1' } };
|
||||||
|
const node2 = { entry: { nodeId: 'shared-node-2' } };
|
||||||
|
component.selection = [node1, node2];
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
element.triggerEventHandler('click', null);
|
||||||
|
|
||||||
|
expect(dialogSpy.calls.argsFor(0)[1].data).toEqual({ nodeIds: [ 'shared-node-1', 'shared-node-2' ] });
|
||||||
|
});
|
||||||
|
|
||||||
it('should download selected folder node as zip', () => {
|
it('should download selected folder node as zip', () => {
|
||||||
const node = { entry: { isFolder: true, id: 'node-id' } };
|
const node = { entry: { isFolder: true, id: 'node-id' } };
|
||||||
component.selection = [node];
|
component.selection = [node];
|
||||||
|
@@ -86,8 +86,10 @@ export class NodeDownloadDirective {
|
|||||||
private downloadFile(node: MinimalNodeEntity) {
|
private downloadFile(node: MinimalNodeEntity) {
|
||||||
if (node && node.entry) {
|
if (node && node.entry) {
|
||||||
const contentApi = this.apiService.getInstance().content;
|
const contentApi = this.apiService.getInstance().content;
|
||||||
|
// nodeId for Shared node
|
||||||
|
const id = (<any> node.entry).nodeId || node.entry.id;
|
||||||
|
|
||||||
const url = contentApi.getContentUrl(node.entry.id, true);
|
const url = contentApi.getContentUrl(id, true);
|
||||||
const fileName = node.entry.name;
|
const fileName = node.entry.name;
|
||||||
|
|
||||||
this.download(url, fileName);
|
this.download(url, fileName);
|
||||||
|
Reference in New Issue
Block a user