How to use the @alfresco/js-api.Node 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 / services / content.service.spec.ts View on Github external
it('should hasAllowableOperations return false if no permission parameter are passed', () => {
            const permissionNode = new Node({ allowableOperations: ['delete', 'update', 'updatePermissions'] });
            expect(contentService.hasAllowableOperations(permissionNode, null)).toBeFalsy();
        });
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / content-widget / attach-file-widget-dialog.component.spec.ts View on Github external
it('should be able to select a file', (done) => {
            data.selected.subscribe((nodeList: Node[]) => {
                expect(nodeList[0].id).toBe('fake');
                expect(nodeList[0].isFile).toBeTruthy();
                done();
            });
            const fakeNode: Node = new Node({ id: 'fake', isFile: true});
            contentNodePanel.componentInstance.select.emit([fakeNode]);
            fixture.detectChanges();
            fixture.whenStable().then(() => {
                const chooseButton: HTMLButtonElement = element.querySelector('button[data-automation-id="attach-file-dialog-actions-choose"]');
                chooseButton.click();
            });
        });
github Alfresco / alfresco-ng2-components / lib / core / services / content.service.spec.ts View on Github external
it('should havePermission works in the opposite way with negate value', () => {
            const permissionNode = new Node({ permissions: { locallySet: [{ name: 'collaborator' }, { name: 'consumer' }] } });
            expect(contentService.hasPermissions(permissionNode, '!manager')).toBeTruthy();
        });
github Alfresco / alfresco-ng2-components / lib / content-services / src / lib / mock / document-list.component.mock.ts View on Github external
* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { Node } from '@alfresco/js-api';

export const fakeNodeWithCreatePermission =  new Node({
    isFile: false,
    createdByUser: { id: 'admin', displayName: 'Administrator' },
    modifiedAt: '2017-06-08T13:53:46.495Z',
    nodeType: 'cm:folder',
    parentId: '55052317-7e59-4058-8e07-769f41e615e1',
    createdAt: '2017-05-22T11:36:11.270Z',
    path: {
        name: '/Company Home/User Homes',
        isComplete: true,
        elements: [{
            id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
            name: 'Company Home'
        }, { id: '55052317-7e59-4058-8e07-769f41e615e1', name: 'User Homes' }]
    },
    isFolder: true,
    modifiedByUser: { id: 'Test', displayName: 'Test' },
github Alfresco / alfresco-ng2-components / lib / content-services / src / lib / mock / document-list.component.mock.ts View on Github external
name: '/Company Home/User Homes',
        isComplete: true,
        elements: [{
            id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
            name: 'Company Home'
        }, { id: '55052317-7e59-4058-8e07-769f41e615e1', name: 'User Homes' }]
    },
    isFolder: true,
    modifiedByUser: { id: 'Test', displayName: 'Test' },
    name: 'Test',
    id: '70e1cc6a-6918-468a-b84a-1048093b06fd',
    properties: {},
    allowableOperations: ['delete', 'update', 'create']
});

export const fakeNodeWithNoPermission = new Node({
    isFile: false,
    createdByUser: { id: 'admin', displayName: 'Administrator' },
    modifiedAt: '2017-06-08T13:53:46.495Z',
    nodeType: 'cm:folder',
    parentId: '55052317-7e59-4058-8e07-769f41e615e1',
    aspectNames: ['cm:ownable', 'cm:auditable'],
    createdAt: '2017-05-22T11:36:11.270Z',
    path: {
        name: '/Company Home/User Homes',
        isComplete: true,
        elements: [{
            id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
            name: 'Company Home'
        }, { id: '55052317-7e59-4058-8e07-769f41e615e1', name: 'User Homes' }]
    },
    isFolder: true,
github Alfresco / alfresco-ng2-components / lib / content-services / version-manager / version-manager.component.spec.ts View on Github external
describe('VersionManagerComponent', () => {
    let component: VersionManagerComponent;
    let fixture: ComponentFixture;
    let spyOnListVersionHistory: jasmine.Spy;
    let alfrescoApiService: AlfrescoApiService;

    const expectedComment = 'test-version-comment';
    const  node: Node = new Node({
        id: '1234',
        name: 'TEST-NODE',
        isFile: true
    });
    const versionEntry = {
       entry: {
           id: '1.0',
           name: node.name,
           versionComment: expectedComment
       }
    };

    setupTestBed({
        imports: [
            CoreModule.forRoot(),
            NoopAnimationsModule