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


TypeScript aurelia-dependency-injection.Container类代码示例

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


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

示例1: describe

describe('ToDo', () => {
  const container = new Container();
  const httpClient = container.get(Rest);
  const githubClient = container.get(Rest);
  const dataServices = new DataServices(httpClient, githubClient);
  let sut = new ToDo(dataServices);

  describe('constructor()', () => {
    it('dataServices should be defined', () => {
      expect(sut.dataServices).toBeDefined();
    });
  });

  describe('activate()', () => {
    let todoItems = [
      { id: 1, description: 'I need to read PinpointTownes' }
    ];
    it('todoItems exist', done => {
      spyOn(dataServices, 'getToDoItems').and.callFake(() => {
        return Promise.resolve(todoItems);
      });
      sut.activate()
        .then(() => {
          expect(sut.todoItems).toBe(todoItems);
          done();
        });
    });
  });
});
开发者ID:SoftwareMasons,项目名称:aurelia-openiddict,代码行数:29,代码来源:todo.spec.ts

示例2: beforeEach

    beforeEach(() => {
        container = new Container();
        container.registerInstance(Element, DOM.createElement("div"));
        templatingEngine = container.get(TemplatingEngine);

        sut = templatingEngine.createViewModelForUnitTest(ScrollSpyElement);
    });
开发者ID:eriklieben,项目名称:old-aurelia-materialize-css-before-rc1,代码行数:7,代码来源:scrollspyElement.spec.ts

示例3: beforeEach

  beforeEach(() => {
    history = new MockHistory();
    container = new Container();
    container.registerSingleton(RouteLoader, MockLoader);
    // tslint:disable-next-line
    ea = { publish() { } } as any;
    viewPort = {
      process(viewPortInstruction: ViewPortInstruction) {
        return Promise.resolve();
      },
      // tslint:disable-next-line
      swap() { }
    } as any;

    // tslint:disable-next-line
    instruction = { resolve() { } } as any;
    provider = {
      createPipeline() {
        let p = new Pipeline();
        p.addStep({ run(inst, next) { return pipelineStep(inst, next); } });
        return p;
      }
    } as any;

    router = new AppRouter(container, history, provider, ea);
  });
开发者ID:aurelia,项目名称:router,代码行数:26,代码来源:app-router.spec.ts

示例4: beforeEach

    beforeEach(() => {
        container = new Container();
        container.registerInstance(Element, DOM.createElement("div"));
        templatingEngine = container.get(TemplatingEngine);
        sut = templatingEngine.createViewModelForUnitTest(DropdownDividerAttribute);

    });
开发者ID:eriklieben,项目名称:old-aurelia-materialize-css-before-rc1,代码行数:7,代码来源:dropdownDividerAttribute.spec.ts

示例5: beforeEach

    beforeEach(() => {
        container = new Container();
        templatingEngine = container.get(TemplatingEngine);

        sut = templatingEngine.createViewModelForUnitTest(ButtonElement);
        sut.element = DOM.createElement("a");
    });
开发者ID:eriklieben,项目名称:old-aurelia-materialize-css-before-rc1,代码行数:7,代码来源:buttonElement.spec.ts

示例6: it

        it('should return null when the parent container is not present', () => {
            var sut = new Parent("test"),
                childContainer = new Container(),
                instance = {};

            childContainer.registerInstance("test", instance);
            expect(sut.get(childContainer)).toBe(null);
        });
开发者ID:behzad888,项目名称:DefinitelyTyped,代码行数:8,代码来源:metadata.spec.ts

示例7: get

 public get(container: Container): any {
     let dynamicDependencies = this.dynamicDependencies.length > 0 ?
         this.dynamicDependencies.map(dependency => dependency["protocol:aurelia:resolver"] ?
         dependency.get(container) : container.invoke(dependency)) : undefined;
     const instance = container.invoke(this.key, dynamicDependencies);
     container.registerInstance(this.asKey, instance);
     return instance;
 }
开发者ID:devaur,项目名称:aurelia-property-injection,代码行数:8,代码来源:resolvers.ts

示例8: beforeAll

 beforeAll(() => {
   const container = new Container();
   container.registerInstance(BindingLanguage, container.get(TemplatingBindingLanguage));
   const messageParser = container.get(ValidationMessageParser);
   const propertyParser = container.get(PropertyAccessorParser);
   ValidationRules.initialize(messageParser, propertyParser);
   validator = container.get(StandardValidator);
 });
开发者ID:doktordirk,项目名称:validation,代码行数:8,代码来源:validator.ts

示例9: beforeAll

 beforeAll(() => {
   let container = new Container();
   bindingEngine = container.get(BindingEngine);
   let bindingBehaviors = {
     updateTrigger: container.get(UpdateTriggerBindingBehavior)
   };
   lookupFunctions = { bindingBehaviors: name => bindingBehaviors[name] };
 });
开发者ID:aurelia,项目名称:templating-resources,代码行数:8,代码来源:update-trigger-binding-behavior.spec.ts

示例10: create

 /**
  * Creates a new controller instance.
  */
 public create(validator?: Validator) {
   if (!validator) {
     validator = this.container.get(Validator) as Validator;
   }
   const propertyParser = this.container.get(PropertyAccessorParser) as PropertyAccessorParser;
   return new ValidationController(validator, propertyParser);
 }
开发者ID:StrahilKazlachev,项目名称:validation,代码行数:10,代码来源:validation-controller-factory.ts


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