本文整理匯總了TypeScript中angular2-testing-lite/core.TestComponentBuilder.createAsync方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TestComponentBuilder.createAsync方法的具體用法?TypeScript TestComponentBuilder.createAsync怎麽用?TypeScript TestComponentBuilder.createAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2-testing-lite/core.TestComponentBuilder
的用法示例。
在下文中一共展示了TestComponentBuilder.createAsync方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should has text: 'My Test'", async(() => {
builder.createAsync(AppComponent)
.then(fixture => {
let el = fixture.debugElement;
assert(el.query(By.css("p")).nativeElement.innerHTML === "My Test");
});
}));
示例2: inject
inject([], () => {
builder
.createAsync(AboutComponent)
.then(fixture => {
assert.equal(fixture.debugElement.nativeElement.innerHTML, `<h3>About Component</h3>
<p>This is the about component!</p>`);
});
}))
示例3: inject
inject([], () => {
builder
.createAsync(HomeComponent)
.then(fixture => {
assert.equal(fixture.debugElement.nativeElement.innerHTML, `<h3>Home Component</h3>
<p>Welcome to Angular Seed</p>`);
});
}))
示例4: expect
() => {
return builder.createAsync(WeatherWidget).then(fixture => {
let component = fixture.componentInstance,
element = fixture.nativeElement;
component.city = 'Berlin';
fixture.detectChanges();
expect(element.querySelector('.weather__detail__temp').innerText)
.to.equal('21.91°C');
});
});
示例5: it
it('should display the city name', () => {
return builder.createAsync(WeatherWidget).then(fixture => {
let component = fixture.componentInstance,
element = fixture.nativeElement;
component.city = 'Berlin';
fixture.detectChanges();
expect(element.querySelector('.weather__city').innerText)
.to.equal('Berlin');
});
});
示例6: inject
inject([], () => {
builder.createAsync(AppRootComponent);
}))
示例7:
() => {
builder.createAsync(RepoBrowserComponent);
})