当前位置: 首页>>代码示例>>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;未经允许,请勿转载。