本文整理汇总了TypeScript中angular2/src/core/di/provider.provide函数的典型用法代码示例。如果您正苦于以下问题:TypeScript provide函数的具体用法?TypeScript provide怎么用?TypeScript provide使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了provide函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: beforeEachProviders
beforeEachProviders(() => {
return [
HTTP_PROVIDERS,
provide(XHRBackend, {useClass: MockBackend}),
provide(BlogService, {useClass: MockBlogService}),
provide(MarkdownService, {useClass: MockMarkdownService}),
provide(Router, {useClass: MockRouter})
]
});
开发者ID:liuyijie,项目名称:angular2-webpack-demo-routing-and-http,代码行数:9,代码来源:blog-roll.spec.ts
示例2: beforeEachProviders
beforeEachProviders(() => [
ROUTER_PROVIDERS,
provide(Location, {useClass: SpyLocation}),
provide(Router, {useClass: RootRouter}),
provide(RouteParams, { useValue: new RouteParams({ id: '2' }) }),
provide(APP_BASE_HREF, {useValue: '/'}),
provide(ROUTER_PRIMARY_COMPONENT, {useValue: AppComponent}),
provide(ApplicationRef, {useClass: MockApplicationRef}),
provide(EmployeeService, {useClass: EmployeeService}),
provide(EmployeeEditComponent, {useClass: EmployeeEditComponent})
]);
开发者ID:mlzharov,项目名称:employee-directory-angular-2-intro,代码行数:11,代码来源:employee-edit.component.spec.ts
示例3: injectAsync
injectAsync([TestComponentBuilder], (tcb) => {
return tcb
.overrideProviders(BlogRoll, [provide(BlogService, {useValue: mockBlogService})])
.createAsync(BlogRoll)
.then((fixture) => {
let nativeElement = fixture.nativeElement;
fixture.detectChanges();
nativeElement.querySelector('i.glyphicon-edit').click();
fixture.detectChanges();
expect(fixture.componentInstance.editing).toBe(true);
let blog = fixture.componentInstance.blog;
expect(blog).toBeDefined();
expect(blog.id).toBeDefined();
});
}));
开发者ID:krimple,项目名称:angular2-unittest-samples-webpack,代码行数:15,代码来源:blog-roll.spec.ts
示例4: it
it('shows list of blog items by default', injectAsync([TestComponentBuilder], (tcb) => {
return tcb
.overrideProviders(BlogRoll, [provide(BlogService, {useValue: mockBlogService})])
.createAsync(BlogRoll)
.then((fixture) => {
let nativeElement = fixture.nativeElement;
fixture.detectChanges();
// we start with the blog roll panel visible
expect(fixture.componentInstance.editing).toBe(false);
expect(nativeElement.querySelector('#blog-editor-panel') === null).toBe(true);
expect(nativeElement.querySelector('#blog-roll-panel') === null).toBe(false);
let trs = nativeElement.querySelectorAll('tr');
expect(trs.length).toBe(2);
let tdTitleContent = trs[1].children[1].innerHTML;
let tdRenderedContent = trs[1].children[2].innerHTML;
expect(tdTitleContent).toContain('The title');
expect(tdRenderedContent).toContain('Hi there');
});
}));
开发者ID:krimple,项目名称:angular2-unittest-samples-webpack,代码行数:23,代码来源:blog-roll.spec.ts
注:本文中的angular2/src/core/di/provider.provide函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论