本文整理汇总了TypeScript中@angular/platform-browser/testing.expect函数的典型用法代码示例。如果您正苦于以下问题:TypeScript expect函数的具体用法?TypeScript expect怎么用?TypeScript expect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expect函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
.then((fixture) => {
fixture.detectChanges();
expect(
getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('hello2');
async.done();
});
示例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: expect
.then((fixture) => {
fixture.detectChanges();
expect(getDOM()
.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me')
.length)
.toEqual(3);
expect(getDOM().getText(fixture.debugElement.nativeElement))
.toEqual('helloNumberhelloStringhelloFunction');
fixture.debugElement.componentInstance.numberCondition = 0;
fixture.detectChanges();
expect(getDOM()
.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me')
.length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('helloString');
fixture.debugElement.componentInstance.numberCondition = 1;
fixture.debugElement.componentInstance.stringCondition = 'bar';
fixture.detectChanges();
expect(getDOM()
.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me')
.length)
.toEqual(1);
expect(fixture.debugElement.nativeElement).toHaveText('helloNumber');
async.done();
});
示例4: getDOM
.then((fixture) => {
fixture.detectChanges();
getDOM().addClass(
getDOM().querySelector(fixture.debugElement.nativeElement, 'copy-me'), "foo");
fixture.debugElement.componentInstance.numberCondition = 2;
fixture.detectChanges();
expect(getDOM().hasClass(
getDOM().querySelector(fixture.debugElement.nativeElement, 'copy-me'),
"foo"))
.toBe(true);
async.done();
});
示例5: expect
xhr.get('test.html').then((text) => {
expect(text).toEqual('<div>Hello</div>');
async.done();
});
示例6: it
it('should throw exception if $templateCache is not found', () => {
setTemplateCache(null);
expect(() => {
xhr = new CachedXHR();
}).toThrowError('CachedXHR: Template cache was not found in $templateCache.');
});
示例7: expect
.then((text) => {
expect(text).toEqual('<div>Hello</div>');
async.done();
});