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


TypeScript compiler.Compiler类代码示例

本文整理汇总了TypeScript中angular2/src/core/linker/compiler.Compiler的典型用法代码示例。如果您正苦于以下问题:TypeScript Compiler类的具体用法?TypeScript Compiler怎么用?TypeScript Compiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: describe

  describe('Compiler', () => {
    var compiler: Compiler;
    var protoViewFactorySpy;
    var someProtoView;
    var cht: CompiledHostTemplate;

    beforeEachBindings(() => {
      protoViewFactorySpy = new SpyProtoViewFactory();
      someProtoView = new AppProtoView(null, null, null, null, null, null, null);
      protoViewFactorySpy.spy('createHost').andReturn(someProtoView);
      var factory = provide(ProtoViewFactory, {useValue: protoViewFactorySpy});
      var classProvider = provide(Compiler, {useClass: Compiler_});
      var providers = [factory, classProvider];
      return providers;
    });

    beforeEach(inject([Compiler], (_compiler) => {
      compiler = _compiler;
      cht = new CompiledHostTemplate(new CompiledComponentTemplate('aCompId', null, null, null));
      reflector.registerType(SomeComponent, new ReflectionInfo([cht]));
    }));

    it('should read the template from an annotation', inject([AsyncTestCompleter], (async) => {
         compiler.compileInHost(SomeComponent)
             .then((_) => {
               expect(protoViewFactorySpy.spy('createHost')).toHaveBeenCalledWith(cht);
               async.done();
             });
       }));

    it('should clear the cache', () => {
      compiler.clearCache();
      expect(protoViewFactorySpy.spy('clearCache')).toHaveBeenCalled();
    });
  });
开发者ID:TedSander,项目名称:angular,代码行数:35,代码来源:compiler_spec.ts

示例2: inject

 inject([AsyncTestCompleter, Compiler], (async, compiler: Compiler) => {
   compiler.compileInHost(SomeComponent).then((hostViewFactoryRef: HostViewFactoryRef_) => {
     expect(hostViewFactoryRef.internalHostViewFactory).toBe(someHostViewFactory);
     async.done();
     return null;
   });
 }));
开发者ID:LordBinary,项目名称:angular,代码行数:7,代码来源:compiler_spec.ts

示例3: it

 it('should read the template from an annotation', inject([AsyncTestCompleter], (async) => {
      compiler.compileInHost(SomeComponent)
          .then((_) => {
            expect(protoViewFactorySpy.spy('createHost')).toHaveBeenCalledWith(cht);
            async.done();
          });
    }));
开发者ID:TedSander,项目名称:angular,代码行数:7,代码来源:compiler_spec.ts


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