本文整理汇总了TypeScript中angular2/testing_internal.TestComponentBuilder.overrideView方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestComponentBuilder.overrideView方法的具体用法?TypeScript TestComponentBuilder.overrideView怎么用?TypeScript TestComponentBuilder.overrideView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/testing_internal.TestComponentBuilder
的用法示例。
在下文中一共展示了TestComponentBuilder.overrideView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ViewMetadata
(tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp, new ViewMetadata({template: `{{!null?.length}}`}))
.createAsync(MyComp)
.then((fixture) => {
fixture.detectChanges();
expect(fixture.nativeElement).toHaveText('true');
async.done();
});
}));
示例2: inject
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(
MyComp, new ViewMetadata({template: '{{true | somePipe}}', pipes: [CustomPipe]}))
.createAsync(MyComp)
.then((fixture) => {
fixture.detectChanges();
expect(fixture.nativeElement).toHaveText('someCustomPipe');
async.done();
});
}));
示例3: inject
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp,
new ViewMetadata({template: `{{'red' + (true ? ' border' : '')}}`}))
.createAsync(MyComp)
.then((fixture) => {
fixture.detectChanges();
expect(fixture.nativeElement).toHaveText('red border');
async.done();
});
}));