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


TypeScript ComponentFixture.whenStable方法代码示例

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


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

示例1: expect

 .createAsync(Talk).then((talk: ComponentFixture<Talk>) => {
     talk.componentInstance.talk = fakeTalk;
     talk.detectChanges();
     talk.whenStable().then(() => {
         const avatar = talk.nativeElement.querySelector('.talk .talk-speakerAvatar').getAttribute('src');
         expect(avatar).toEqual(fakeTalk.speaker.avatar);
         talk.destroy();
     });
 });
开发者ID:manland,项目名称:angular2-bien-ou-pas-bien,代码行数:9,代码来源:Talk.spec.ts

示例2: expect

      builder.createAsync(WeatherWidget).then((fixture: ComponentFixture<WeatherWidget>) => {
        fixture.autoDetectChanges();
        fixture.debugElement.query(By.css('#w-zip')).nativeElement.value = '84111';
        fixture.debugElement.query(By.css('button')).nativeElement.click();

        fixture.whenStable().then((waited) => {
          expect(waited).toBe(true);
          expect(fixture.debugElement.query(By.css('span')).nativeElement.textContent).toEqual('70');
        });
      });
开发者ID:narainsagar,项目名称:ngconf-2016-zones,代码行数:10,代码来源:async_test.ts

示例3: expect

    dialog.open(PizzaMsg, config).then(dialogRef => {
      viewContainerFixture.detectChanges();

      let afterCloseResult: string;
      dialogRef.afterClosed().subscribe(result => {
        afterCloseResult = result;
      });

      dialogRef.close('Charmander');

      viewContainerFixture.whenStable().then(() => {
        expect(afterCloseResult).toBe('Charmander');
        expect(overlayContainerElement.childNodes.length).toBe(0);
      });
    });
开发者ID:2947721120,项目名称:material2,代码行数:15,代码来源:dialog.spec.ts

示例4: setTimeout

          setTimeout(() => {
            rootRenderer.executeCommands();
            expect(mock.commandLogs.toString()).toEqual(
              'CREATE+5+cmp-a+{},CREATE+6+native-text+{},CREATE+7+native-rawtext+{"text":"a"},ATTACH+6+7+0,ATTACH+5+6+0,ATTACH+3+5+1');
            mock.clearLogs();

            var target = fixture.elementRef.nativeElement.children[0];
            fireGesture('swipe', target);

            fixture.whenStable().then(() => {
              rootRenderer.executeCommands();
              expect(mock.commandLogs.toString()).toEqual(
                'CREATE+8+cmp-b+{},CREATE+9+native-text+{},CREATE+10+native-rawtext+{"text":"b"},DETACH+3+1,ATTACH+3+8+1,ATTACH+9+10+0,ATTACH+8+9+0');
            });
          }, 0);
开发者ID:HarunOr,项目名称:react-native-renderer,代码行数:15,代码来源:router_link_spec.ts

示例5: expect

        .then((fixture: ComponentFixture<any>) => {
          fixture.componentInstance.username._value = 'user';
          fixture.componentInstance.password._value = 'pass';
          fixture.detectChanges();
          expect(fixture.componentInstance.username._value).toEqual('user');
          expect(fixture.componentInstance.password._value).toEqual('pass');

          spyOn(fixture.componentInstance, 'onReset').and.callThrough();
          let button = fixture.nativeElement.querySelector('#qa-clear-button');
          button.click();

          fixture.whenStable().then(() => {
             fixture.detectChanges();
             expect(fixture.componentInstance.onReset).toHaveBeenCalled();
             expect(fixture.componentInstance.username._value).toBeNull();
             expect(fixture.componentInstance.password._value).toBeNull();
          });
        });
开发者ID:bennett000,项目名称:angular2-chat,代码行数:18,代码来源:login-form.test.ts


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