当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript testing_internal.AsyncTestCompleter类代码示例

本文整理汇总了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();
          });
开发者ID:truckfondue,项目名称:angular2-minimalist-starter,代码行数:27,代码来源:contact-form.component_spec.ts

示例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();
          });
开发者ID:brunkb,项目名称:a2-contact,代码行数:42,代码来源:spec.ts

示例3: expect

 tcb.createAsync(HomeComponent).then((fixture) => {
   const compiled = fixture.debugElement.nativeElement;
   expect(compiled.querySelector('h2').textContent).toEqual('Home!');
   async.done();
 });
开发者ID:brunkb,项目名称:a2-contact,代码行数:5,代码来源:spec.ts

示例4:

 connection1.response.subscribe(() => { async.done(); });
开发者ID:AwelEshetu,项目名称:angular,代码行数:1,代码来源:mock_backend_spec.ts


注:本文中的angular2/testing_internal.AsyncTestCompleter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。