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


TypeScript ComponentFixture.autoDetectChanges方法代码示例

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


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

示例1: expect

 .then((fixture: ComponentFixture<any>) => {
   fixture.componentInstance.pending = true;
   fixture.autoDetectChanges();
   let alert = fixture.nativeElement.querySelector('#qa-pending');
   expect(alert).not.toBeNull();
   expect(alert.innerText).toEqual('Loading...');
 });
开发者ID:bennett000,项目名称:angular2-chat,代码行数:7,代码来源:login-form.test.ts

示例2: expect

 .then((fixture: ComponentFixture<any>) => {
   fixture.autoDetectChanges();
   let query = fixture.debugElement
     .query(By.directive(RioModalContent));
   expect(query).toBeTruthy();
   expect(query.componentInstance).toBeTruthy();
 });
开发者ID:Alber70g,项目名称:angular2-redux-starter,代码行数:7,代码来源:modal-content.test.ts

示例3: expect

 .then((fixture: ComponentFixture<any>) => {
   fixture.autoDetectChanges();
   let query = fixture.debugElement
     .query(By.directive(RioLabel));
   expect(query.nativeElement.querySelector('label')
     .getAttribute('id')).toBe('test-1');
 });
开发者ID:DavyDuDu,项目名称:angular2-redux-starter,代码行数:7,代码来源:label.test.ts

示例4: Promise

    tcb.createAsync(TestComponent).then((fixture: ComponentFixture<TestComponent>) => {
        fixture.autoDetectChanges();
        rootRenderer.executeCommands();
        expect(mock.commandLogs.toString()).toEqual('CREATE+2+test-cmp+{},CREATE+3+native-view+{},CREATE+4+router-outlet+{},ATTACH+1+2+0,ATTACH+2+3+0,ATTACH+3+4+0');
        mock.clearLogs();

        return new Promise((resolve: any) => {
          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);

            setTimeout(() => {
              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');
              resolve();
            }, 30);
          }, 0);
        });
      });
开发者ID:DavyDuDu,项目名称:react-native-renderer,代码行数:25,代码来源:router_link_spec.ts

示例5: expect

 .then((fixture: ComponentFixture<any>) => {
   fixture.autoDetectChanges();
   let query = fixture.debugElement
     .query(By.directive(RioForm));
   query.componentInstance.submit.subscribe(c => {
     expect(c).toBeDefined();
   });
   query.nativeElement.querySelector('button').click();
 });
开发者ID:bennett000,项目名称:uc-davis-chat,代码行数:9,代码来源:form.test.ts

示例6: querySelector

 .then((fixture: ComponentFixture<any>) => {
   fixture.componentInstance.password._touched = true;
   fixture.componentInstance.password._valid = false;
   fixture.autoDetectChanges();
   let alert = fixture.nativeElement.
     querySelector('#qa-password-validation');
   expect(alert).not.toBeNull();
   expect(alert.innerText).toEqual('Password is required');
 });
开发者ID:bennett000,项目名称:angular2-chat,代码行数:9,代码来源:login-form.test.ts

示例7: 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


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