本文整理汇总了TypeScript中angular2/testing_internal.AsyncTestCompleter类的典型用法代码示例。如果您正苦于以下问题:TypeScript AsyncTestCompleter类的具体用法?TypeScript AsyncTestCompleter怎么用?TypeScript AsyncTestCompleter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AsyncTestCompleter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
.createAsync(ContactFormComponent).then((fixture) => {
fixture.detectChanges();
const originalLength = contacts.length;
expect(originalLength).toBeGreaterThan(0);
const cmp: ContactFormComponent = fixture.componentInstance;
const newContact: Contact = { name: 'Test', email: 'test@example.com' };
cmp.contact = newContact;
cmp.save();
fixture.detectChanges();
const createdContact = contacts[originalLength];
expect(contacts.length).toBe(originalLength + 1);
expect(createdContact.name).toEqual(newContact.name);
expect(createdContact.email).toEqual(newContact.email);
expect(cmp.contact).toEqual({});
async.done();
});
示例2: obtainContactsLenght
.createAsync(ContactComponent).then((fixture) => {
fixture.detectChanges();
const cmp: ContactComponent = fixture.componentInstance;
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h2').textContent).toEqual('Contacts!');
const itemsSelector = 'tbody tr';
function obtainContactsLenght() {
return compiled.querySelectorAll(itemsSelector).length;
}
const originalLength = obtainContactsLenght();
let newLength = originalLength;
expect(originalLength).toBeGreaterThan(0);
expect(originalLength).toBe(contacts.length);
const existingContact = ObjectUtil.clone(contacts[0]);
cmp.select(existingContact._id);
fixture.detectChanges();
const selectedContact = cmp.selectedContact;
expect(selectedContact._id).toBe(existingContact._id);
expect(selectedContact.name).toBe(existingContact.name);
cmp.remove(new Event('mock'), existingContact);
fixture.detectChanges();
newLength--;
expect(obtainContactsLenght()).toBe(newLength);
async.done();
});
示例3: expect
tcb.createAsync(HomeComponent).then((fixture) => {
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h2').textContent).toEqual('Home!');
async.done();
});
示例4:
connection1.response.subscribe(() => { async.done(); });