本文整理汇总了TypeScript中@alfresco/adf-core.CoreModule类的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreModule类的具体用法?TypeScript CoreModule怎么用?TypeScript CoreModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CoreModule类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('Injecting custom colums for tasklist - CustomTaskListComponent', () => {
let fixtureCustom: ComponentFixture<CustomTaskListComponent>;
let componentCustom: CustomTaskListComponent;
setupTestBed({
imports: [CoreModule.forRoot()],
declarations: [TaskListCloudComponent, CustomTaskListComponent],
providers: [TaskListCloudService]
});
beforeEach(() => {
fixtureCustom = TestBed.createComponent(CustomTaskListComponent);
fixtureCustom.detectChanges();
componentCustom = fixtureCustom.componentInstance;
});
afterEach(() => {
fixtureCustom.destroy();
});
it('should create instance of CustomTaskListComponent', () => {
expect(componentCustom instanceof CustomTaskListComponent).toBe(true, 'should create CustomTaskListComponent');
});
it('should fetch custom schemaColumn from html', () => {
fixture.detectChanges();
expect(componentCustom.taskList.columnList).toBeDefined();
expect(componentCustom.taskList.columns[0]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.NAME');
expect(componentCustom.taskList.columns[1]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED');
expect(componentCustom.taskList.columns.length).toEqual(3);
});
});
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:33,代码来源:task-list-cloud.component.spec.ts
示例2: beforeEach
beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreModule.forRoot()],
declarations: [HomeComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
});
});
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:7,代码来源:home.component.spec.ts
示例3: describe
describe('CustomProcessListComponent', () => {
let fixture: ComponentFixture<CustomProcessListComponent>;
let component: CustomProcessListComponent;
setupTestBed({
imports: [CoreModule.forRoot()],
declarations: [ProcessInstanceListComponent, CustomProcessListComponent],
providers: [ProcessService]
});
beforeEach(() => {
fixture = TestBed.createComponent(CustomProcessListComponent);
fixture.detectChanges();
component = fixture.componentInstance;
});
it('should create instance of CustomProcessListComponent', () => {
expect(component instanceof CustomProcessListComponent).toBe(true, 'should create CustomProcessListComponent');
});
it('should fetch custom schemaColumn from html', () => {
fixture.detectChanges();
expect(component.processList.columns).toBeDefined();
expect(component.processList.columns.length).toEqual(3);
expect(component.processList.columns[1]['title']).toEqual('ADF_PROCESS_LIST.PROPERTIES.END_DATE');
expect(component.processList.columns[2]['title']).toEqual('ADF_PROCESS_LIST.PROPERTIES.CREATED');
});
});
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:28,代码来源:process-list.component.spec.ts
示例4: beforeEach
beforeEach( async(() => {
TestBed.configureTestingModule({
imports: [CoreModule.forRoot(), ProcessServiceCloudTestingModule, AppListCloudModule],
providers: [
AppsProcessCloudService
]
})
.overrideComponent(AppListCloudComponent, {
set: {
providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }
]
}
}).compileComponents();
}));
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:15,代码来源:app-list-cloud.component.spec.ts
示例5: describe
describe('AppsProcessCloudService', () => {
let service: AppsProcessCloudService;
setupTestBed({
imports: [CoreModule.forRoot(), ProcessServiceCloudTestingModule],
providers: [AppsProcessCloudService]
});
beforeEach(() => {
service = TestBed.get(AppsProcessCloudService);
});
it('should get the deployed applications ', (done) => {
spyOn(service, 'getDeployedApplicationsByStatus').and.returnValue(of(fakeApplicationInstance));
service.getDeployedApplicationsByStatus('fake').subscribe(
(res: ApplicationInstanceModel[]) => {
expect(res).toBeDefined();
expect(res.length).toEqual(3);
expect(res).toEqual(fakeApplicationInstance);
expect(res[0]).toEqual(fakeApplicationInstance[0]);
expect(res[0].name).toEqual('application-new-1');
expect(res[1]).toEqual(fakeApplicationInstance[1]);
expect(res[1].name).toEqual('application-new-2');
done();
}
);
});
it('Should not fetch deployed applications if error occurred', () => {
const errorResponse = new HttpErrorResponse({
error: 'Mock Error',
status: 404, statusText: 'Not Found'
});
spyOn(service, 'getDeployedApplicationsByStatus').and.returnValue(throwError(errorResponse));
service.getDeployedApplicationsByStatus('fake')
.subscribe(
(users) => fail('expected an error, not applications'),
(error) => {
expect(error.status).toEqual(404);
expect(error.statusText).toEqual('Not Found');
expect(error.error).toEqual('Mock Error');
}
);
});
});
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:47,代码来源:apps-process-cloud.service.spec.ts
示例6: describe
describe('AttachFileWidgetDialogService', () => {
let service: AttachFileWidgetDialogService;
let materialDialog: MatDialog;
let spyOnDialogOpen: jasmine.Spy;
let afterOpenObservable: Subject<any>;
setupTestBed({
imports: [
CoreModule.forRoot(),
ProcessModule.forRoot()
]
});
beforeEach(() => {
service = TestBed.get(AttachFileWidgetDialogService);
materialDialog = TestBed.get(MatDialog);
spyOnDialogOpen = spyOn(materialDialog, 'open').and.returnValue({
afterOpen: () => afterOpenObservable,
afterClosed: () => of({}),
componentInstance: {
error: new Subject<any>()
}
});
});
it('should be able to create the service', () => {
expect(service).not.toBeNull();
expect(service).toBeDefined();
});
it('should be able to open the dialog when node has permission', () => {
service.openLogin('fake-title', 'fake-action');
expect(spyOnDialogOpen).toHaveBeenCalled();
});
it('should be able to close the material dialog', () => {
spyOn(materialDialog, 'closeAll');
service.close();
expect(materialDialog.closeAll).toHaveBeenCalled();
});
});
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:43,代码来源:attach-file-widget-dialog.service.spec.ts
示例7: describe
describe('DropdownSitesComponent', () => {
let component: any;
let fixture: ComponentFixture<DropdownSitesComponent>;
let debug: DebugElement;
let element: HTMLElement;
let siteService: SitesService;
setupTestBed({
imports: [
NoopAnimationsModule,
CoreModule.forRoot()
],
declarations: [
DropdownSitesComponent
],
providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }
]
});
describe('Rendering tests', () => {
describe('Infinite Loading', () => {
beforeEach(async(() => {
siteService = TestBed.get(SitesService);
fixture = TestBed.createComponent(DropdownSitesComponent);
debug = fixture.debugElement;
element = fixture.nativeElement;
component = fixture.componentInstance;
}));
it('Should show loading item if there are more itemes', async(() => {
spyOn(siteService, 'getSites').and.returnValue(of({
'list': {
'pagination': {
'count': 2,
'hasMoreItems': true,
'totalItems': 2,
'skipCount': 0,
'maxItems': 100
},
'entries': [
{
'entry': {
'role': 'SiteManager',
'visibility': 'PUBLIC',
'guid': 'fake-1',
'description': 'fake-test-site',
'id': 'fake-test-site',
'preset': 'site-dashboard',
'title': 'fake-test-site'
}
},
{
'entry': {
'role': 'SiteManager',
'visibility': 'PUBLIC',
'guid': 'fake-2',
'description': 'This is a Sample Alfresco Team site.',
'id': 'swsdp',
'preset': 'site-dashboard',
'title': 'fake-test-2'
}
}
]
}
}));
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('[data-automation-id="lsite-loading"]')).toBeDefined();
});
}));
it('Should not show loading item if there are more itemes', async(() => {
spyOn(siteService, 'getSites').and.returnValue(of({
'list': {
'pagination': {
'count': 2,
'hasMoreItems': false,
'totalItems': 2,
'skipCount': 0,
'maxItems': 100
},
'entries': [
{
'entry': {
'role': 'SiteManager',
'visibility': 'PUBLIC',
'guid': 'fake-1',
'description': 'fake-test-site',
'id': 'fake-test-site',
'preset': 'site-dashboard',
'title': 'fake-test-site'
}
},
{
//.........这里部分代码省略.........
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:101,代码来源:sites-dropdown.component.spec.ts
示例8: describe
describe('FolderActionsService', () => {
let service: FolderActionsService;
let documentListService: DocumentListService;
setupTestBed({
imports: [
CoreModule.forRoot()
]
});
beforeEach(() => {
let appConfig: AppConfigService = TestBed.get(AppConfigService);
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
let contentService = new ContentService(null, null, null, null);
let alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
documentListService = new DocumentListService(null, contentService, alfrescoApiService, null, null);
service = new FolderActionsService(null, documentListService, contentService, new TranslationMock());
});
it('should register custom action handler', () => {
let handler: ContentActionHandler = function () {
};
service.setHandler('<key>', handler);
expect(service.getHandler('<key>')).toBe(handler);
});
it('should not find handler that is not registered', () => {
expect(service.getHandler('<missing>')).toBeNull();
});
it('should be case insensitive for keys', () => {
let handler: ContentActionHandler = function () {
};
service.setHandler('<key>', handler);
expect(service.getHandler('<KEY>')).toBe(handler);
});
it('should not find handler with invalid key', () => {
expect(service.getHandler(null)).toBeNull();
expect(service.getHandler('')).toBeNull();
});
it('should allow action execution only when service available', () => {
let folder = new FolderNode();
expect(service.canExecuteAction(folder)).toBeTruthy();
});
it('should allow action execution only for folder nodes', () => {
expect(service.canExecuteAction(null)).toBeFalsy();
expect(service.canExecuteAction(new FileNode())).toBeFalsy();
expect(service.canExecuteAction(new FolderNode())).toBeTruthy();
});
it('should set new handler only by key', () => {
let handler: ContentActionHandler = function () {
};
expect(service.setHandler(null, handler)).toBeFalsy();
expect(service.setHandler('', handler)).toBeFalsy();
expect(service.setHandler('my-handler', handler)).toBeTruthy();
});
it('should register delete action', () => {
expect(service.getHandler('delete')).toBeDefined();
});
it('should not delete the folder node if there are no permissions', (done) => {
spyOn(documentListService, 'deleteNode').and.callThrough();
service.permissionEvent.subscribe((permission) => {
expect(permission).toBeDefined();
expect(permission.type).toEqual('folder');
expect(permission.action).toEqual('delete');
done();
});
let folder = new FolderNode();
service.getHandler('delete')(folder);
});
it('should delete the folder node if there is the delete permission', () => {
spyOn(documentListService, 'deleteNode').and.callFake(() => {
return new Observable<any>((observer) => {
observer.next();
observer.complete();
});
});
let permission = 'delete';
let folder = new FolderNode();
let folderWithPermission: any = folder;
folderWithPermission.entry.allowableOperations = [permission];
const deleteObservable = service.getHandler('delete')(folderWithPermission, null, permission);
expect(documentListService.deleteNode).toHaveBeenCalledWith(folder.entry.id);
expect(deleteObservable.subscribe).toBeDefined();
});
//.........这里部分代码省略.........
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:101,代码来源:folder-actions.service.spec.ts
示例9: describe
describe('AttachFileWidgetDialogComponent', () => {
let widget: AttachFileWidgetDialogComponent;
let fixture: ComponentFixture<AttachFileWidgetDialogComponent>;
let data: AttachFileWidgetDialogComponentData = {
title: 'Move along citizen...',
actionName: 'move',
selected: new EventEmitter<any>(),
ecmHost: 'http://fakeUrl.com/'
};
let element: HTMLInputElement;
let authService: AuthenticationService;
let siteService: SitesService;
let isLogged = false;
setupTestBed({
imports: [
CoreModule.forRoot(),
ProcessTestingModule,
ContentModule.forRoot(),
RouterTestingModule
],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: data }
]
});
beforeEach(async(() => {
fixture = TestBed.createComponent(AttachFileWidgetDialogComponent);
widget = fixture.componentInstance;
element = fixture.nativeElement;
authService = fixture.debugElement.injector.get(AuthenticationService);
siteService = fixture.debugElement.injector.get(SitesService);
spyOn(siteService, 'getSites').and.returnValue(of({ list: { entries: [] } }));
spyOn(widget, 'isLoggedIn').and.callFake(() => {
return isLogged;
});
}));
afterEach(() => {
fixture.destroy();
});
it('should be able to create the widget', () => {
expect(widget).not.toBeNull();
});
describe('When is not logged in', () => {
beforeEach(async(() => {
fixture.detectChanges();
isLogged = false;
}));
it('should show the login form', () => {
expect(element.querySelector('#attach-file-login-panel')).not.toBeNull();
expect(element.querySelector('#username')).not.toBeNull();
expect(element.querySelector('#password')).not.toBeNull();
expect(element.querySelector('button[data-automation-id="attach-file-dialog-actions-login"]')).not.toBeNull();
});
it('should be able to login', (done) => {
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket'}));
isLogged = true;
let loginButton: HTMLButtonElement = element.querySelector('button[data-automation-id="attach-file-dialog-actions-login"]');
let usernameInput: HTMLInputElement = element.querySelector('#username');
let passwordInput: HTMLInputElement = element.querySelector('#password');
usernameInput.value = 'fakse-user';
passwordInput.value = 'fakse-user';
usernameInput.dispatchEvent(new Event('input'));
passwordInput.dispatchEvent(new Event('input'));
loginButton.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(element.querySelector('#attach-file-content-node')).not.toBeNull();
loginButton = element.querySelector('button[data-automation-id="attach-file-dialog-actions-login"]');
let chooseButton = element.querySelector('button[data-automation-id="attach-file-dialog-actions-choose"]');
expect(loginButton).toBeNull();
expect(chooseButton).not.toBeNull();
done();
});
});
});
describe('When is logged in', () => {
let contentNodePanel;
beforeEach(async(() => {
isLogged = true;
fixture.detectChanges();
contentNodePanel = fixture.debugElement.query(By.directive(ContentNodeSelectorPanelComponent));
}));
it('should show the content node selector', () => {
expect(element.querySelector('#attach-file-content-node')).not.toBeNull();
expect(element.querySelector('#username')).toBeNull();
expect(element.querySelector('#password')).toBeNull();
//.........这里部分代码省略.........
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:101,代码来源:attach-file-widget-dialog.component.spec.ts
示例10: describe
describe('Task Cloud Service', () => {
let service: TaskCloudService;
let alfrescoApiMock: AlfrescoApiServiceMock;
let identityUserService: IdentityUserService;
function returnFakeTaskCompleteResults() {
return {
oauth2Auth: {
callCustomApi : () => {
return Promise.resolve(taskCompleteCloudMock);
}
}
};
}
function returnFakeTaskCompleteResultsError() {
return {
oauth2Auth: {
callCustomApi : () => {
return Promise.reject(taskCompleteCloudMock);
}
}
};
}
function returnFakeTaskDetailsResults() {
return {
oauth2Auth: {
callCustomApi : () => {
return Promise.resolve(fakeTaskDetailsCloud);
}
}
};
}
setupTestBed({
imports: [
CoreModule.forRoot()
],
providers: [ IdentityUserService ]
});
beforeEach(async(() => {
alfrescoApiMock = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService() );
identityUserService = TestBed.get(IdentityUserService);
spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(cloudMockUser);
service = new TaskCloudService(alfrescoApiMock,
new AppConfigService(null),
new LogService(new AppConfigService(null)),
identityUserService);
}));
it('should complete a task', (done) => {
const appName = 'simple-app';
const taskId = '68d54a8f';
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnFakeTaskCompleteResults);
service.completeTask(appName, taskId).subscribe((res: any) => {
expect(res).toBeDefined();
expect(res).not.toBeNull();
expect(res.entry.appName).toBe('simple-app');
expect(res.entry.id).toBe('68d54a8f');
done();
});
});
it('should not complete a task', (done) => {
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnFakeTaskCompleteResultsError);
const appName = 'simple-app';
const taskId = '68d54a8f';
service.completeTask(appName, taskId).toPromise().then( (res: any) => {
}, (error) => {
expect(error).toBeDefined();
done();
});
});
it('should canCompleteTask', () => {
const canCompleteTaskResult = service.canCompleteTask(taskDetailsCloudMock);
expect(canCompleteTaskResult).toBeTruthy();
});
it('should return the task details when claiming a task', (done) => {
const appName = 'taskp-app';
const assignee = 'user12';
const taskId = '68d54a8f';
spyOn(alfrescoApiMock, 'getInstance').and.callFake(returnFakeTaskDetailsResults);
service.claimTask(appName, taskId, assignee).subscribe((res: any) => {
expect(res).toBeDefined();
expect(res).not.toBeNull();
expect(res.appName).toBe('task-app');
expect(res.id).toBe('68d54a8f');
done();
});
});
it('should throw error if appName is not defined when claiming a task', (done) => {
const appName = null;
//.........这里部分代码省略.........
开发者ID:Alfresco,项目名称:alfresco-ng2-components,代码行数:101,代码来源:task-cloud.service.spec.ts
注:本文中的@alfresco/adf-core.CoreModule类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论