當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript testing.expect函數代碼示例

本文整理匯總了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();
 });
開發者ID:0xJoKe,項目名稱:angular,代碼行數:8,代碼來源:ng_if_spec.ts

示例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');
       })));
開發者ID:jessepinho,項目名稱:angular,代碼行數:8,代碼來源:xhr_cache_spec.ts

示例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();
                 });
開發者ID:EdS0ng,項目名稱:angular,代碼行數:27,代碼來源:ng_if_spec.ts

示例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();
               });
開發者ID:0xJoKe,項目名稱:angular,代碼行數:14,代碼來源:ng_if_spec.ts

示例5: expect

 xhr.get('test.html').then((text) => {
   expect(text).toEqual('<div>Hello</div>');
   async.done();
 });
開發者ID:jessepinho,項目名稱:angular,代碼行數:4,代碼來源:xhr_cache_spec.ts

示例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.');
 });
開發者ID:jessepinho,項目名稱:angular,代碼行數:6,代碼來源:xhr_cache_spec.ts

示例7: expect

 .then((text) => {
   expect(text).toEqual('<div>Hello</div>');
   async.done();
 });
開發者ID:Coco-wan,項目名稱:angular,代碼行數:4,代碼來源:xhr_cache_spec.ts


注:本文中的@angular/platform-browser/testing.expect函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。