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


TypeScript TestBed.overrideTemplate方法代码示例

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


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

示例1: it

    it('should translate templates', () => {
      const tb: ComponentFixture<I18nComponent> =
          TestBed.overrideTemplate(I18nComponent, HTML).createComponent(I18nComponent);
      const cmp: I18nComponent = tb.componentInstance;
      const el: DebugElement = tb.debugElement;

      validateHtml(tb, cmp, el);
    });
开发者ID:lucduong,项目名称:angular,代码行数:8,代码来源:integration_xliff2_spec.ts

示例2: it

    it('should match directives on ng-template created by * syntax', () => {
      TestBed.configureTestingModule({declarations: [TestComponent, TestDirective]});
      TestBed.overrideTemplate(TestComponent, `<div *test></div>`);

      const fixture = TestBed.createComponent(TestComponent);
      const nodesWithDirective = fixture.debugElement.queryAllNodes(By.directive(TestDirective));

      expect(nodesWithDirective.length).toBe(1);
    });
开发者ID:alxhub,项目名称:angular,代码行数:9,代码来源:directive_spec.ts

示例3: getFieldComponent

function getFieldComponent(template: string): FieldComponent {

  TestBed.overrideTemplate(TestComponent, template);
  TestBed.compileComponents();
  const fixture = TestBed.createComponent(TestComponent);
  fixture.detectChanges();

  return fixture.componentInstance.field;

}
开发者ID:makinacorpus,项目名称:angular2-schema-form,代码行数:10,代码来源:field.component.spec.ts

示例4: beforeEach

  beforeEach(() => {
    jasmine.clock().mockDate(DateTime.fromISO('2017-12-29T12:13:00Z').toJSDate());

    TestBed.overrideTemplate(ChartComponent, '');
    TestBed.configureTestingModule({
      declarations: [SpentTimeStatisticsComponent, ChartComponent, DurationPipe, PageTitleDirective],
      imports: [RouterTestingModule.withRoutes([
        {
          path: 'tasks/statistics', component: SpentTimeStatisticsComponent
        }
      ]), ReactiveFormsModule, GlobeNgbModule.forRoot(), CurrentUserModule.forRoot(), HttpClientModule],
      providers: [{ provide: ActivatedRoute, useFactory: () => route }]
    });

    const taskService = TestBed.get(TaskService);
    spyOn(taskService, 'spentTimeStatistics').and.returnValue(EMPTY);
  });
开发者ID:Ninja-Squad,项目名称:globe42,代码行数:17,代码来源:spent-time-statistics.component.spec.ts

示例5: executeTest

    function executeTest(template: string) {
      TestBed.overrideTemplate(DestroyCasesComp, template).configureTestingModule({
        schemas: [NO_ERRORS_SCHEMA]
      });

      const fixture = TestBed.createComponent(DestroyCasesComp);
      fixture.detectChanges();
      const initial = fixture.nativeElement.innerHTML;

      const structDirs = fixture.componentInstance.structDirs.toArray();

      structDirs.forEach(structDir => structDir.create());
      fixture.detectChanges();
      expect(fixture.nativeElement).toHaveText('Foo');

      structDirs.forEach(structDir => structDir.destroy());
      fixture.detectChanges();
      expect(fixture.nativeElement.innerHTML).toEqual(initial);
    }
开发者ID:StephenFluin,项目名称:angular,代码行数:19,代码来源:view_container_ref_spec.ts

示例6: createHostComponent

function createHostComponent(template: string): ComponentFixture<HostComponent> {
  TestBed.overrideTemplate(HostComponent, template);
  const fixture = TestBed.createComponent(HostComponent);
  fixture.detectChanges();
  return fixture as ComponentFixture<HostComponent>;
}
开发者ID:dimpu,项目名称:angular2-markdown,代码行数:6,代码来源:ngx-md.component.spec.ts

示例7: beforeEach

  beforeEach(async(() => {
    jasmine.clock().mockDate(DateTime.fromISO('2017-08-01T12:30:00').toJSDate());

    const tasks: Array<TaskModel> = [];
    for (let i = 0; i < 3; i++) {
      tasks.push(
        {
          id: i,
          description: 'Some description',
          title: 'Some title',
          category: {
            id: 6,
            name: 'Various'
          },
          dueDate: '2017-08-01',
          status: 'DONE',
          totalSpentTimeInMinutes: 0,
          assignee: null,
          creator: {
            id: 1,
            login: 'admin'
          } as UserModel,
          concernedPerson: null
        }
      );
    }

    page = {
      content: tasks,
      number: 0,
      size: 3,
      totalElements: 8,
      totalPages: 3,
    };

    data = {
      taskListType: 'todo',
      tasks: page
    };

    activatedRoute = {
      data: of(data),
      parent: {
        parent: {
          snapshot: {
            data: {}
          }
        }
      }
    } as any;

    TestBed.overrideTemplate(SpentTimeAddComponent, '');
    TestBed.overrideTemplate(SpentTimesComponent, '');

    TestBed.configureTestingModule({
      imports: [CurrentUserModule.forRoot(), RouterTestingModule, GlobeNgbModule.forRoot(), HttpClientModule],
      declarations: [
        TasksPageComponent,
        TasksComponent,
        FullnamePipe,
        SpentTimesComponent,
        SpentTimeAddComponent,
        DurationPipe,
        PageTitleDirective
      ],
      providers: [{ provide: ActivatedRoute, useFactory: () => activatedRoute }]
    });
  }));
开发者ID:Ninja-Squad,项目名称:globe42,代码行数:68,代码来源:tasks-page.component.spec.ts


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