How to use the @alfresco/js-api.NodeEntry function in @alfresco/js-api

To help you get started, we’ve selected a few @alfresco/js-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Alfresco / alfresco-ng2-components / lib / core / viewer / components / viewer.component.spec.ts View on Github external
it('should change display name every time node changes', fakeAsync(() => {
        spyOn(alfrescoApiService.nodesApi, 'getNode').and.returnValues(
            Promise.resolve(new NodeEntry({ entry: { name: 'file1', content: {} } })),
            Promise.resolve(new NodeEntry({ entry: { name: 'file2', content: {} } }))
        );

        component.urlFile = null;
        component.displayName = null;
        component.blobFile = null;
        component.showViewer = true;

        component.nodeId = 'id1';
        component.ngOnChanges();
        tick();

        expect(component.fileTitle).toBe('file1');

        component.nodeId = 'id2';
        component.ngOnChanges();
        tick();
github Alfresco / alfresco-ng2-components / lib / core / viewer / components / viewer.component.spec.ts View on Github external
describe('display name property override by nodeId', () => {

            const displayName = 'the-name';
            const nodeDetails = new NodeEntry({ entry: { name: displayName, id: '12', content: { mimeType: 'txt' } } });
            const contentUrl = '/content/url/path';
            const alfrescoApiInstanceMock = {
                nodes: {
                    getNode: () => Promise.resolve(nodeDetails)
                },
                content: { getContentUrl: () => contentUrl }
            };

            it('should use the node name if displayName is NOT set and nodeId is set', (done) => {
                component.nodeId = '12';
                component.urlFile = null;
                component.displayName = null;
                spyOn(alfrescoApiService, 'getInstance').and.returnValue(alfrescoApiInstanceMock);

                component.ngOnChanges();
                fixture.whenStable().then(() => {
github Alfresco / alfresco-ng2-components / lib / core / viewer / components / viewer.component.spec.ts View on Github external
it('should get and assign node for download', (done) => {
                component.nodeId = '12';
                component.urlFile = '';
                const displayName = 'the-name';
                const node = new NodeEntry({ entry: { name: displayName, id: '12', content: { mimeType: 'txt' } } });
                const nodeDetails = { name: displayName, id: '12', content: { mimeType: 'txt' } };
                const contentUrl = '/content/url/path';
                const alfrescoApiInstanceMock = {
                    nodes: {
                        getNodeInfo: () => Promise.resolve(nodeDetails),
                        getNode: () => Promise.resolve(node)
                    },
                    content: { getContentUrl: () => contentUrl }
                };
                spyOn(alfrescoApiService, 'getInstance').and.returnValue(alfrescoApiInstanceMock);

                component.ngOnChanges();
                fixture.whenStable().then(() => {
                    fixture.detectChanges();
                    expect(component.nodeEntry).toBe(node);
                    done();
github Alfresco / alfresco-ng2-components / lib / content-services / tree-view / models / tree-view.model.ts View on Github external
constructor(nodeEntry: NodeEntry, level?: number, expandable?: boolean) {
        this.name = nodeEntry.entry.name;
        this.nodeId = nodeEntry.entry.id;
        this.level = level ? level : 0;
        this.expandable = expandable ? expandable : true;
        this.node = nodeEntry ? new NodeEntry(nodeEntry) : undefined;

    }
}