本文整理汇总了TypeScript中@angular/compiler/testing.TestComponentBuilder.createFakeAsync方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestComponentBuilder.createFakeAsync方法的具体用法?TypeScript TestComponentBuilder.createFakeAsync怎么用?TypeScript TestComponentBuilder.createFakeAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/compiler/testing.TestComponentBuilder
的用法示例。
在下文中一共展示了TestComponentBuilder.createFakeAsync方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: tick
(router: Router, location: Location, tcb: TestComponentBuilder) => {
tcb.createFakeAsync(AppComponent)
router.navigate(['/'])
tick()
expect(location.path()).toBe('')
}
示例2: fakeAsync
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
let fixture = tcb.createFakeAsync(TestComponent);
// This should initialize the fixture.
tick();
expect(fixture.debugElement.children[0].nativeElement).toHaveText('Hello');
})));
示例3: it
it('should display the weather ', fakeAsync(() => {
let fixture = testComponentBuilder.createFakeAsync(WeatherComponent);
let element = fixture.nativeElement;
let component = fixture.componentInstance;
component.weather = {place: 'New York', humidity: 44, temperature: 57};
fixture.detectChanges();
expect(element.querySelector('h3').innerHTML).toBe('Current weather in New York:');
expect(element.querySelector('li:nth-of-type(1)').innerHTML).toBe('Temperature: 57F');
expect(element.querySelector('li:nth-of-type(2)').innerHTML).toBe('Humidity: 44%');
}));
示例4: advance
(tcb: TestComponentBuilder, location: Location, angulartics2: Angulartics2, angulartics2Piwik: Angulartics2Piwik) => {
fixture = tcb.createFakeAsync(RootCmp);
angulartics2.setUserProperties.next({ userId: '1', firstName: 'John', lastName: 'Doe' });
advance(fixture);
expect(_paq).toContain(['setCustomVariable', { userId: '1', firstName: 'John', lastName: 'Doe' }]);
})));
示例5: tick
(router: Router, location: Location, tcb: TestComponentBuilder) => {
tcb.createFakeAsync(MyApp);
router.navigateByUrl('/about');
tick();
expect(location.path()).toEqual('/about');
})