當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。