當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。