• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript testing.fixmeIvy函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@angular/private/testing.fixmeIvy函数的典型用法代码示例。如果您正苦于以下问题:TypeScript fixmeIvy函数的具体用法?TypeScript fixmeIvy怎么用?TypeScript fixmeIvy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了fixmeIvy函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: describe

    describe('typescript support', () => {

      fixmeIvy('FW-738: ngtsc doesn\'t generate flat index files') &&
          it('should have an index d.ts file',
             () => { expect(shx.cat('core.d.ts')).toContain(`export *`); });

      it('should not have amd module names',
         () => { expect(shx.cat('public_api.d.ts')).not.toContain('<amd-module name'); });
    });
开发者ID:thorn0,项目名称:angular,代码行数:9,代码来源:core_package.spec.ts


示例2: describe

describe('upgrade/static (full)', () => {
  beforeEach(loadPage);
  afterEach(verifyNoBrowserErrors);

  it('should render the `ng2-heroes` component', () => {
    expect(element(by.css('h1')).getText()).toEqual('Heroes');
    expect(element.all(by.css('p')).get(0).getText()).toEqual('There are 3 heroes.');
  });

  it('should render 3 ng1-hero components', () => {
    const heroComponents = element.all(by.css('ng1-hero'));
    expect(heroComponents.count()).toEqual(3);
  });

  fixmeIvy('unknown; <ng1Hero> component does not seem to render name & description')
      .it('should add a new hero when the "Add Hero" button is pressed', () => {
        const addHeroButton = element.all(by.css('button')).last();
        expect(addHeroButton.getText()).toEqual('Add Hero');
        addHeroButton.click();
        const heroComponents = element.all(by.css('ng1-hero'));
        expect(heroComponents.last().element(by.css('h2')).getText()).toEqual('Kamala Khan');
      });

  fixmeIvy('unknown; <ng1Hero> component does not seem to render name & description')
      .it('should remove a hero when the "Remove" button is pressed', () => {
        let firstHero = element.all(by.css('ng1-hero')).get(0);
        expect(firstHero.element(by.css('h2')).getText()).toEqual('Superman');

        const removeHeroButton = firstHero.element(by.css('button'));
        expect(removeHeroButton.getText()).toEqual('Remove');
        removeHeroButton.click();

        const heroComponents = element.all(by.css('ng1-hero'));
        expect(heroComponents.count()).toEqual(2);

        firstHero = element.all(by.css('ng1-hero')).get(0);
        expect(firstHero.element(by.css('h2')).getText()).toEqual('Wonder Woman');
      });
});
开发者ID:matsko,项目名称:angular,代码行数:39,代码来源:static_full_spec.ts


示例3: describe

  describe('ng-if-then-else', () => {
    let comp = 'ng-if-then-else';

    fixmeIvy('unknown. Run "yarn bazel run packages/examples/common:devserver" to debug')
        .it('should hide/show content', () => {
          browser.get(URL);
          waitForElement(comp);
          expect(element.all(by.css(comp)).get(0).getText())
              .toEqual('hideSwitch Primary show = true\nPrimary text to show');
          element.all(by.css(comp + ' button')).get(1).click();
          expect(element.all(by.css(comp)).get(0).getText())
              .toEqual('hideSwitch Primary show = true\nSecondary text to show');
          element.all(by.css(comp + ' button')).get(0).click();
          expect(element.all(by.css(comp)).get(0).getText())
              .toEqual(
                  'showSwitch Primary show = false\nAlternate text while primary text is hidden');
        });
  });
开发者ID:matsko,项目名称:angular,代码行数:18,代码来源:ngIf_spec.ts


示例4: describe

describe('ngc_wrapped', () => {

  // fixmeIvy placeholder to prevent jasmine from erroring out because there are no specs
  it('should be removed once the fixmeIvy below is resolved', () => {});

  fixmeIvy('FW-741: ngtsc breaks tsc module resolution') && it('should work', () => {
    const {read, write, runOneBuild, writeConfig, shouldExist, basePath} = setup();

    write('some_project/index.ts', `
      import {Component} from '@angular/core';
      import {a} from 'ambient_module';
      console.log('works: ', Component);
    `);

    const tsconfig = writeConfig({
      srcTargetPath: 'some_project',
    });
    const typesFile = path.resolve(
        tsconfig.compilerOptions.rootDir, tsconfig.compilerOptions.typeRoots[0], 'thing',
        'index.d.ts');

    write(typesFile, `
      declare module "ambient_module" {
        declare const a = 1;
      }
    `);

    // expect no error
    expect(runOneBuild()).toBe(true);

    shouldExist('bazel-bin/some_project/index.js');

    expect(read('bazel-bin/some_project/index.js'))
        .toContain(`console.log('works: ', core_1.Component);`);
  });
});
开发者ID:thorn0,项目名称:angular,代码行数:36,代码来源:index_test.ts


示例5: describe

  describe('examples', () => {

    beforeEach(() => destroyPlatform());
    afterEach(() => destroyPlatform());

    it('should have AngularJS loaded', () => expect(angular.version.major).toBe(1));

    fixmeIvy('FW-714: ng1 projected content is not being rendered') &&
        it('should verify UpgradeAdapter example', async(() => {

             // This is wrapping (upgrading) an AngularJS component to be used in an Angular
             // component
             @Directive({selector: 'ng1'})
             class Ng1Component extends UpgradeComponent {
               // TODO(issue/24571): remove '!'.
               @Input() title !: string;

               constructor(elementRef: ElementRef, injector: Injector) {
                 super('ng1', elementRef, injector);
               }
             }

             // This is an Angular component that will be downgraded
             @Component({
               selector: 'ng2',
               template: 'ng2[<ng1 [title]="nameProp">transclude</ng1>](<ng-content></ng-content>)'
             })
             class Ng2Component {
               // TODO(issue/24571): remove '!'.
               @Input('name') nameProp !: string;
             }

             // This module represents the Angular pieces of the application
             @NgModule({
               declarations: [Ng1Component, Ng2Component],
               entryComponents: [Ng2Component],
               imports: [BrowserModule, UpgradeModule]
             })
             class Ng2Module {
               ngDoBootstrap() { /* this is a placeholder to stop the bootstrapper from
                                    complaining */
               }
             }

             // This module represents the AngularJS pieces of the application
             const ng1Module =
                 angular
                     .module('myExample', [])
                     // This is an AngularJS component that will be upgraded
                     .directive(
                         'ng1',
                         () => {
                           return {
                             scope: {title: '='},
                             transclude: true,
                             template: 'ng1[Hello {{title}}!](<span ng-transclude></span>)'
                           };
                         })
                     // This is wrapping (downgrading) an Angular component to be used in
                     // AngularJS
                     .directive('ng2', downgradeComponent({component: Ng2Component}));

             // This is the (AngularJS) application bootstrap element
             // Notice that it is actually a downgraded Angular component
             const element = html('<ng2 name="World">project</ng2>');

             // Let's use a helper function to make this simpler
             bootstrap(platformBrowserDynamic(), Ng2Module, element, ng1Module).then(upgrade => {
               expect(multiTrim(element.textContent))
                   .toBe('ng2[ng1[Hello World!](transclude)](project)');
             });
           }));
  });
开发者ID:thorn0,项目名称:angular,代码行数:73,代码来源:examples_spec.ts


示例6: describe

describe('ngtools_api (deprecated)', () => {
  let testSupport: TestSupport;

  beforeEach(() => { testSupport = setup(); });

  function createProgram(rootNames: string[]) {
    const options = testSupport.createCompilerOptions();
    const host = ts.createCompilerHost(options, true);
    const program =
        ts.createProgram(rootNames.map(p => path.resolve(testSupport.basePath, p)), options, host);
    return {program, host, options};
  }

  function writeSomeRoutes() {
    testSupport.writeFiles({
      'src/main.ts': `
        import {NgModule, Component} from '@angular/core';
        import {RouterModule} from '@angular/router';

        // Component with metadata errors.
        @Component(() => {if (1==1) return null as any;})
        export class ErrorComp2 {}

        @NgModule({
          declarations: [ErrorComp2, NonExistentComp],
          imports: [RouterModule.forRoot([{loadChildren: './child#ChildModule'}])]
        })
        export class MainModule {}
      `,
      'src/child.ts': `
        import {NgModule} from '@angular/core';
        import {RouterModule} from '@angular/router';

        @NgModule({
          imports: [RouterModule.forChild([{loadChildren: './child2#ChildModule2'}])]
        })
        export class ChildModule {}
      `,
      'src/child2.ts': `
        import {NgModule} from '@angular/core';

        @NgModule()
        export class ChildModule2 {}
      `,
    });
  }

  fixmeIvy('FW-629: ngtsc lists lazy routes').it('should list lazy routes recursively', () => {
    writeSomeRoutes();
    const {program, host, options} = createProgram(['src/main.ts']);
    const routes = NgTools_InternalApi_NG_2.listLazyRoutes({
      program,
      host,
      angularCompilerOptions: options,
      entryModule: 'src/main#MainModule',
    });
    expect(routes).toEqual({
      './child#ChildModule': path.resolve(testSupport.basePath, 'src/child.ts'),
      './child2#ChildModule2': path.resolve(testSupport.basePath, 'src/child2.ts'),
    });
  });

  it('should allow to emit the program after analyzing routes', () => {
    writeSomeRoutes();
    const {program, host, options} = createProgram(['src/main.ts']);
    NgTools_InternalApi_NG_2.listLazyRoutes({
      program,
      host,
      angularCompilerOptions: options,
      entryModule: 'src/main#MainModule',
    });
    program.emit();
    testSupport.shouldExist('built/src/main.js');
  });
});
开发者ID:cyrilletuzi,项目名称:angular,代码行数:75,代码来源:ngtools_api_spec.ts


示例7: describe

describe('setUpLocationSync', () => {
  let upgradeModule: UpgradeModule;
  let RouterMock: any;
  let LocationMock: any;

  beforeEach(() => {
    RouterMock = jasmine.createSpyObj('Router', ['navigateByUrl']);
    LocationMock = jasmine.createSpyObj('Location', ['normalize']);

    TestBed.configureTestingModule({
      providers: [
        UpgradeModule, {provide: Router, useValue: RouterMock},
        {provide: Location, useValue: LocationMock}
      ],
    });

    upgradeModule = TestBed.get(UpgradeModule);
    upgradeModule.$injector = {
      get: jasmine.createSpy('$injector.get').and.returnValue({'$on': () => undefined})
    };
  });

  it('should throw an error if the UpgradeModule.bootstrap has not been called', () => {
    upgradeModule.$injector = null;

    expect(() => setUpLocationSync(upgradeModule)).toThrowError(`
        RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.
        Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.
      `);
  });

  fixmeIvy('FW-777: R3Injector doesn\'t support injectors as a provider') &&
      it('should get the $rootScope from AngularJS and set an $on watch on $locationChangeStart',
         () => {
           const $rootScope = jasmine.createSpyObj('$rootScope', ['$on']);

           upgradeModule.$injector.get.and.callFake(
               (name: string) => (name === '$rootScope') && $rootScope);

           setUpLocationSync(upgradeModule);

           expect($rootScope.$on).toHaveBeenCalledTimes(1);
           expect($rootScope.$on)
               .toHaveBeenCalledWith('$locationChangeStart', jasmine.any(Function));
         });

  fixmeIvy('FW-777: R3Injector doesn\'t support injectors as a provider') &&
      it('should navigate by url every time $locationChangeStart is broadcasted', () => {
        const url = 'https://google.com';
        const pathname = '/custom/route';
        const normalizedPathname = 'foo';
        const query = '?query=1&query2=3';
        const hash = '#new/hash';
        const $rootScope = jasmine.createSpyObj('$rootScope', ['$on']);

        upgradeModule.$injector.get.and.returnValue($rootScope);
        LocationMock.normalize.and.returnValue(normalizedPathname);

        setUpLocationSync(upgradeModule);

        const callback = $rootScope.$on.calls.argsFor(0)[1];
        callback({}, url + pathname + query + hash, '');

        expect(LocationMock.normalize).toHaveBeenCalledTimes(1);
        expect(LocationMock.normalize).toHaveBeenCalledWith(pathname);

        expect(RouterMock.navigateByUrl).toHaveBeenCalledTimes(1);
        expect(RouterMock.navigateByUrl).toHaveBeenCalledWith(normalizedPathname + query + hash);
      });

  fixmeIvy('FW-777: R3Injector doesn\'t support injectors as a provider') &&
      it('should work correctly on browsers that do not start pathname with `/`', () => {
        const anchorProto = HTMLAnchorElement.prototype;
        const originalDescriptor = Object.getOwnPropertyDescriptor(anchorProto, 'pathname');
        Object.defineProperty(anchorProto, 'pathname', {get: () => 'foo/bar'});

        try {
          const $rootScope = jasmine.createSpyObj('$rootScope', ['$on']);
          upgradeModule.$injector.get.and.returnValue($rootScope);

          setUpLocationSync(upgradeModule);

          const callback = $rootScope.$on.calls.argsFor(0)[1];
          callback({}, '', '');

          expect(LocationMock.normalize).toHaveBeenCalledWith('/foo/bar');
        } finally {
          Object.defineProperty(anchorProto, 'pathname', originalDescriptor !);
        }
      });
});
开发者ID:thorn0,项目名称:angular,代码行数:91,代码来源:upgrade.spec.ts


示例8: describe


//.........这里部分代码省略.........
        providers: [SomeService]
      })];

      SomePublicComponent.annotations = [new Component({templateUrl: 'somePublicUrl.html'})];
      resourceLoader.expect('somePublicUrl.html', `Hello public world!`);

      SomePrivateComponent.annotations = [new Component({templateUrl: 'somePrivateUrl.html'})];
      resourceLoader.expect('somePrivateUrl.html', `Hello private world!`);

      SomeDirective.annotations = [new Directive({selector: '[someDir]'})];

      SomePipe.annotations = [new Pipe({name: 'somePipe'})];

      SomeService.annotations = [new Injectable()];
    }

    function clearMetadata() {
      Base.parameters = [];
      SomeModule.annotations = [];
      SomePublicComponent.annotations = [];
      SomePrivateComponent.annotations = [];
      SomeDirective.annotations = [];
      SomePipe.annotations = [];
      SomeService.annotations = [];
    }

    beforeEach(async(() => {
      instances = new Map<any, any>();
      createSummaries().then(s => summaries = s);
    }));

    afterEach(() => { resetTestEnvironmentWithSummaries(); });

    fixmeIvy('FW-514: ngSummary shims not generated by ngtsc') &&
        it('should use directive metadata from summaries', () => {
          resetTestEnvironmentWithSummaries(summaries);

          @Component({template: '<div someDir></div>'})
          class TestComp {
          }

          TestBed
              .configureTestingModule(
                  {providers: [SomeDep], declarations: [TestComp, SomeDirective]})
              .createComponent(TestComp);
          expectInstanceCreated(SomeDirective);
        });

    fixmeIvy('FW-514: ngSummary shims not generated by ngtsc') &&
        it('should use pipe metadata from summaries', () => {
          resetTestEnvironmentWithSummaries(summaries);

          @Component({template: '{{1 | somePipe}}'})
          class TestComp {
          }

          TestBed.configureTestingModule({providers: [SomeDep], declarations: [TestComp, SomePipe]})
              .createComponent(TestComp);
          expectInstanceCreated(SomePipe);
        });

    fixmeIvy('FW-514: ngSummary shims not generated by ngtsc') &&
        it('should use Service metadata from summaries', () => {
          resetTestEnvironmentWithSummaries(summaries);

          TestBed.configureTestingModule({
开发者ID:thorn0,项目名称:angular,代码行数:67,代码来源:jit_summaries_integration_spec.ts


示例9: describe

  describe('NoopAnimationsModule', () => {
    beforeEach(() => { TestBed.configureTestingModule({imports: [NoopAnimationsModule]}); });

    it('should be removed once FW-800 is fixed', () => { expect(true).toBeTruthy(); });

    // TODO: remove the dummy test above ^ once the bug FW-800 has been fixed
    fixmeIvy(`FW-800: Animation listeners are not invoked`)
        .it('should flush and fire callbacks when the zone becomes stable', (async) => {
          @Component({
            selector: 'my-cmp',
            template:
                '<div [@myAnimation]="exp" (@myAnimation.start)="onStart($event)" (@myAnimation.done)="onDone($event)"></div>',
            animations: [trigger(
                'myAnimation',
                [transition(
                    '* => state',
                    [style({'opacity': '0'}), animate(500, style({'opacity': '1'}))])])],
          })
          class Cmp {
            exp: any;
            startEvent: any;
            doneEvent: any;
            onStart(event: any) { this.startEvent = event; }
            onDone(event: any) { this.doneEvent = event; }
          }

          TestBed.configureTestingModule({declarations: [Cmp]});

          const fixture = TestBed.createComponent(Cmp);
          const cmp = fixture.componentInstance;
          cmp.exp = 'state';
          fixture.detectChanges();
          fixture.whenStable().then(() => {
            expect(cmp.startEvent.triggerName).toEqual('myAnimation');
            expect(cmp.startEvent.phaseName).toEqual('start');
            expect(cmp.doneEvent.triggerName).toEqual('myAnimation');
            expect(cmp.doneEvent.phaseName).toEqual('done');
            async();
          });
        });

    fixmeIvy(`FW-800: Animation listeners are not invoked`)
        .it('should handle leave animation callbacks even if the element is destroyed in the process',
            (async) => {
              @Component({
                selector: 'my-cmp',
                template:
                    '<div *ngIf="exp" @myAnimation (@myAnimation.start)="onStart($event)" (@myAnimation.done)="onDone($event)"></div>',
                animations: [trigger(
                    'myAnimation',
                    [transition(
                        ':leave',
                        [style({'opacity': '0'}), animate(500, style({'opacity': '1'}))])])],
              })
              class Cmp {
                exp: any;
                startEvent: any;
                doneEvent: any;
                onStart(event: any) { this.startEvent = event; }
                onDone(event: any) { this.doneEvent = event; }
              }

              TestBed.configureTestingModule({declarations: [Cmp]});
              const engine = TestBed.get(ÉľAnimationEngine);
              const fixture = TestBed.createComponent(Cmp);
              const cmp = fixture.componentInstance;

              cmp.exp = true;
              fixture.detectChanges();
              fixture.whenStable().then(() => {
                cmp.startEvent = null;
                cmp.doneEvent = null;

                cmp.exp = false;
                fixture.detectChanges();
                fixture.whenStable().then(() => {
                  expect(cmp.startEvent.triggerName).toEqual('myAnimation');
                  expect(cmp.startEvent.phaseName).toEqual('start');
                  expect(cmp.startEvent.toState).toEqual('void');
                  expect(cmp.doneEvent.triggerName).toEqual('myAnimation');
                  expect(cmp.doneEvent.phaseName).toEqual('done');
                  expect(cmp.doneEvent.toState).toEqual('void');
                  async();
                });
              });
            });
  });
开发者ID:felixfbecker,项目名称:angular,代码行数:87,代码来源:noop_animations_module_spec.ts


示例10: describe

  describe('JIT', () => {
    @Injectable({providedIn: null})
    class Service {
    }

    @NgModule({
      providers: [Service],
    })
    class JitModule {
    }

    @NgModule({
      imports: [JitModule],
    })
    class JitAppModule {
    }

    it('works', () => { createInjector(JitAppModule); });

    fixmeIvy('FW-645: jit doesn\'t support forwardRefs') &&
        it('throws an error on circular module dependencies', () => {
          @NgModule({
            imports: [forwardRef(() => BModule)],
          })
          class AModule {
          }

          @NgModule({
            imports: [AModule],
          })
          class BModule {
          }

          expect(() => createInjector(AModule))
              .toThrowError(
                  'Circular dependency in DI detected for type AModule. Dependency path: AModule > BModule > AModule.');
        });

    it('merges imports and exports', () => {
      const TOKEN = new InjectionToken<string>('TOKEN');
      @NgModule({
        providers: [{provide: TOKEN, useValue: 'provided from A'}],
      })
      class AModule {
      }
      @NgModule({
        providers: [{provide: TOKEN, useValue: 'provided from B'}],
      })
      class BModule {
      }

      @NgModule({
        imports: [AModule],
        exports: [BModule],
      })
      class CModule {
      }

      const injector = createInjector(CModule);
      expect(injector.get(TOKEN)).toEqual('provided from B');
    });
  });
开发者ID:thorn0,项目名称:angular,代码行数:62,代码来源:module_spec.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript testing.obsoleteInIvy函数代码示例发布时间:2022-05-28
下一篇:
TypeScript browser.bootstrap函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap