本文整理汇总了TypeScript中@angular/compiler/testing.TestComponentBuilder.overrideTemplate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestComponentBuilder.overrideTemplate方法的具体用法?TypeScript TestComponentBuilder.overrideTemplate怎么用?TypeScript TestComponentBuilder.overrideTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/compiler/testing.TestComponentBuilder
的用法示例。
在下文中一共展示了TestComponentBuilder.overrideTemplate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
(tcb: TestComponentBuilder, async: AsyncTestCompleter) => {
var template = `<template [ngTemplateOutlet]="null"></template>`;
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
expect(fixture.nativeElement).toHaveText('');
async.done();
});
}));
示例2: inject
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
tcb.overrideTemplate(TestCmp, `
<ul>
<li *ngFor="let item of collection | paginate: config" class="list-item">{{ item }}</li>
</ul>
<pagination-controls autoHide="false"></pagination-controls>`)
.createAsync(TestCmp)
.then((fixture: ComponentFixture<TestCmp>) => {
fixture.detectChanges();
expect(fixture.componentInstance.directionLinks).toBe(false);
});
}));
示例3: it
it('should define default values for value and bufferValue attributes', (done: () => void) => {
builder
.overrideTemplate(TestApp, '<md-progress-bar></md-progress-bar>')
.createAsync(TestApp)
.then((fixture) => {
fixture.detectChanges();
let progressElement = fixture.debugElement.query(By.css('md-progress-bar'));
expect(progressElement.componentInstance.value).toBe(0);
expect(progressElement.componentInstance.bufferValue).toBe(0);
done();
});
});
示例4: it
it('should detect and apply changes to model', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
var template = '<div><ig-grid [(widgetId)]="gridID" [(options)]="opts"></ig-grid></div>';
return tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
$(fixture.debugElement.nativeElement).find("#grid1 tr[data-id='2'] td[aria-describedby='grid1_Name']").click();
$(fixture.debugElement.nativeElement).find("#grid1").igGridUpdating("setCellValue", 2, "Name", "Mary Jackson");
$(fixture.debugElement.nativeElement).find("#grid1_container #grid1_updating_done").click();
expect(fixture.debugElement.componentInstance.data[1].Name)
.toBe("Mary Jackson");
});
}));
示例5: Promise
return new Promise((resolve, reject) => {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
fixture.componentInstance.data = "<span>Test Update</span>";
setTimeout(function () {
fixture.detectChanges();
expect($("#htmlEditor").igHtmlEditor("getContent", "html")).toBe("<span>Test Update</span>");
resolve();
}, 10);
});
});
示例6: it
it('should set the correct list height in fixed mode', async(() => {
var template = `
<md-grid-list cols="1" rowHeight="100px">
<md-grid-tile></md-grid-tile>
<md-grid-tile></md-grid-tile>
</md-grid-list>`;
builder.overrideTemplate(TestGridList, template).createAsync(TestGridList).then(fixture => {
fixture.detectChanges();
let list = fixture.debugElement.query(By.directive(MdGridList));
expect(getProp(list, 'height')).toBe('201px');
});
}));
示例7: it
it('should throw error if tile colspan is wider than total cols', () => {
var template = `
<md-grid-list cols="4">
<md-grid-tile colspan="5"></md-grid-tile>
</md-grid-list>
`;
return builder.overrideTemplate(TestGridList, template)
.createAsync(TestGridList).then((fixture: ComponentFixture<TestGridList>) => {
expect(() => {
fixture.detectChanges();
}).toThrowError(/tile with colspan 5 is wider than grid/);
});
});
示例8: async
async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
var template = '<ig-tab-bar></ig-tab-bar>';
return tcb.overrideTemplate(TestComponentDI, template)
.createAsync(TestComponentDI)
.then((fixture) => {
expect(fixture.componentInstance.viewChild).toBeDefined();
expect(fixture.componentInstance.viewChild).toBeAnInstanceOf(Infragistics.TabBar);
//expect(fixture.componentInstance.viewChild.state).toBeAnInstanceOf(Infragistics.NavigationService);
}).catch (reason => {
console.log(reason);
return Promise.reject(reason);
});
})));
示例9: Promise
return new Promise((resolve, reject) => {
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
.then((fixture) => {
fixture.detectChanges();
fixture.componentInstance.data[0].Name = "Test";
setTimeout(() => {
fixture.detectChanges();
expect($($("#tree1").igTree("nodeByIndex", 0)).children("a").text())
.toBe("Test");
resolve();
}, 10);
});
});