当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript TestComponentBuilder.createAsync方法代码示例

本文整理汇总了TypeScript中angular2/testing_internal.TestComponentBuilder.createAsync方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestComponentBuilder.createAsync方法的具体用法?TypeScript TestComponentBuilder.createAsync怎么用?TypeScript TestComponentBuilder.createAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/testing_internal.TestComponentBuilder的用法示例。


在下文中一共展示了TestComponentBuilder.createAsync方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: inject

 inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
   tcb.createAsync(HomeComponent).then((fixture) => {
     const compiled = fixture.debugElement.nativeElement;
     expect(compiled.querySelector('h2').textContent).toEqual('Home!');
     async.done();
   });
 }));
开发者ID:brunkb,项目名称:a2-contact,代码行数:7,代码来源:spec.ts

示例2: inject

 inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
   tcb.createAsync(AppCmp).then((fixture) => {
     var router = fixture.debugElement.componentInstance.router;
     PromiseWrapper.catchError(router.navigateByUrl('/cause-error'), (error) => {
       expect(error).toContainError('oops!');
       async.done();
     });
   });
 }));
开发者ID:LordBinary,项目名称:angular,代码行数:9,代码来源:bootstrap_spec.ts

示例3: fakeAsync

       fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
         let fixture: ComponentFixture;
         tcb.createAsync(TestComponent).then((f) => { fixture = f; });

         // This should initialize the fixture.
         tick();

         expect(fixture.debugElement.children[0].nativeElement).toHaveText('Hello');
       })));
开发者ID:844496869,项目名称:angular,代码行数:9,代码来源:xhr_cache_spec.ts

示例4: inject

 inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
   tcb.createAsync(AppCmp).then((rootTC) => {
     var router = rootTC.debugElement.componentInstance.router;
     PromiseWrapper.catchError(router.navigateByUrl('/cause-error'), (error) => {
       expect(rootTC.debugElement.nativeElement).toHaveText('outer { oh no }');
       expect(error).toContainError('oops!');
       async.done();
     });
   });
 }));
开发者ID:,项目名称:,代码行数:10,代码来源:

示例5: inject

       inject([AsyncTestCompleter, Router], (async, router) => {

         tcb.createAsync(TestComponent).then((testComponent) => {
           testComponent.detectChanges();
           testComponent.debugElement.query(By.css('a.detail-view-blank'))
               .triggerEventHandler('click', null);
           expect(router.spy('navigateByInstruction')).not.toHaveBeenCalled();
           async.done();
         });
       }));
开发者ID:LordBinary,项目名称:angular,代码行数:10,代码来源:router_link_spec.ts

示例6: it

    it('should update a[href] attribute', inject([AsyncTestCompleter], (async) => {

         tcb.createAsync(TestComponent).then((testComponent) => {
           testComponent.detectChanges();
           let anchorElement =
               testComponent.debugElement.query(By.css('a.detail-view')).nativeElement;
           expect(DOM.getAttribute(anchorElement, 'href')).toEqual('detail');
           async.done();
         });
       }));
开发者ID:LordBinary,项目名称:angular,代码行数:10,代码来源:router_link_spec.ts

示例7: inject

         inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
           tcb.createAsync(TestComp).then((fixture) => {
             let mutable: number[] = [1, 2];
             fixture.debugElement.componentInstance.data = mutable;
             fixture.detectChanges();
             expect(fixture.debugElement.nativeElement).toHaveText('2');

             mutable.push(3);
             fixture.detectChanges();
             expect(fixture.debugElement.nativeElement).toHaveText('2,3');

             async.done();
           });
         }));
开发者ID:LordBinary,项目名称:angular,代码行数:14,代码来源:slice_pipe_spec.ts


注:本文中的angular2/testing_internal.TestComponentBuilder.createAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。