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


TypeScript TestDispose.add方法代码示例

本文整理汇总了TypeScript中external/gs_tools/src/testing.TestDispose.add方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestDispose.add方法的具体用法?TypeScript TestDispose.add怎么用?TypeScript TestDispose.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在external/gs_tools/src/testing.TestDispose的用法示例。


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

示例1: beforeEach

 beforeEach(() => {
   mockRouteService = Mocks.listenable('RouteService');
   TestDispose.add(mockRouteService);
   const mockThemeService = jasmine.createSpyObj('ThemeService', ['applyTheme']);
   breadcrumb = new Breadcrumb(mockThemeService);
   TestDispose.add(breadcrumb);
 });
开发者ID:garysoed,项目名称:gs-ui,代码行数:7,代码来源:breadcrumb_test.ts

示例2: beforeEach

 beforeEach(() => {
   mockDocument = jasmine.createSpyObj('Document', ['createElement', 'querySelector']);
   mockTemplates = jasmine.createSpyObj('Templates', ['getTemplate']);
   mockWindow = jasmine.createSpyObj('Window', ['getComputedStyle']);
   service = new ThemeService(mockTemplates, mockWindow, mockDocument);
   TestDispose.add(service);
 });
开发者ID:garysoed,项目名称:gs-ui,代码行数:7,代码来源:theme-service_test.ts

示例3: beforeEach

 beforeEach(() => {
   const injector = Mocks.object('injector');
   mockThemeService = jasmine.createSpyObj('ThemeService', ['applyTheme', 'install']);
   mockRegistrar = jasmine.createSpyObj('Registrar', ['register']);
   main = new Main(injector, mockThemeService, mockRegistrar);
   TestDispose.add(main);
 });
开发者ID:garysoed,项目名称:gs-ui,代码行数:7,代码来源:main_test.ts

示例4: it

    it('should set up correctly', () => {
      const ace = Mocks.object('ace');
      const routeFactoryServiceCtor = Mocks.object('routeFactoryServiceCtor');
      const templates = Mocks.object('templates');
      spyOn(Templates, 'newInstance').and.returnValue(templates);

      const mockThemeService = jasmine.createSpyObj('ThemeService', ['initialize', 'install']);
      const factories = Mocks.object('factories');
      const mockRouteFactoryService = jasmine.createSpyObj('RouteFactoryService', ['getFactories']);
      mockRouteFactoryService.getFactories.and.returnValue(factories);
      const mockInjector = jasmine.createSpyObj('Injector', ['bindProvider', 'getBoundValue']);
      Fakes.build(mockInjector.getBoundValue)
          .when('theming.ThemeService').return(mockThemeService)
          .when('x.gs_ui.routeFactoryService').return(mockRouteFactoryService);
      spyOn(Injector, 'newInstance').and.returnValue(mockInjector);

      const mockRegistrar = jasmine.createSpyObj('Registrar', ['register']);

      spyOn(ElementRegistrar, 'newInstance').and.returnValue(mockRegistrar);
      spyOn(Persona, 'registerAll');

      const main = Main.newInstance({
        ace: ace,
        routeFactoryServiceCtor: routeFactoryServiceCtor,
      });
      TestDispose.add(main);

      assert(main['injector_']).to.equal(mockInjector);
      assert(main['themeService_']).to.equal(mockThemeService);
      assert(main['registrar_']).to.equal(mockRegistrar);

      assert(mockThemeService.initialize).to.haveBeenCalledWith();
      assert(mockInjector.getBoundValue).to.haveBeenCalledWith('theming.ThemeService');
      assert(ElementRegistrar.newInstance).to.haveBeenCalledWith(mockInjector, templates);
      assert(TestInject.getBoundValue('x.dom.document')()).to.equal(document);
      assert(TestInject.getBoundValue('x.dom.window')()).to.equal(window);
      assert(TestInject.getBoundValue('x.gs_tools.templates')()).to.equal(templates);
      assert(TestInject.getBoundValue('x.gs_ui.routeFactoryService'))
          .to.equal(routeFactoryServiceCtor);
      assert(TestInject.getBoundValue('x.ace')()).to.equal(ace);

      assert(Templates.newInstance).to.haveBeenCalledWith();
      assert(Persona.registerAll).to.haveBeenCalledWith(mockInjector, templates);
    });
开发者ID:garysoed,项目名称:gs-ui,代码行数:44,代码来源:main_test.ts

示例5: it

    it(`should do nothing if the target element cannot be found`, async () => {
      const triggeredBy = 'triggeredBy';
      spyOn(Persona, 'getValue').and.returnValue(triggeredBy);

      const origDisposable = DisposableFunction.of(() => undefined);
      Graph.createProvider($triggeredByRegistration, origDisposable);
      TestDispose.add(origDisposable);

      const mockRootNode = jasmine.createSpyObj('RootNode', ['querySelector']);
      Object.setPrototypeOf(mockRootNode, Element.prototype);
      mockRootNode.querySelector.and.returnValue(null);

      const mockElement = jasmine.createSpyObj('Element', ['getRootNode']);
      mockElement.getRootNode.and.returnValue(mockRootNode);
      Object.setPrototypeOf(mockElement, HTMLElement.prototype);
      await Graph.createProvider($.host.el.getId(), mockElement);

      await menu.onTriggeredByChanged_();
      assert(mockRootNode.querySelector).to.haveBeenCalledWith(triggeredBy);
      assert(origDisposable.isDisposed()).to.beFalse();
    });
开发者ID:garysoed,项目名称:gs-ui,代码行数:21,代码来源:menu_test.ts

示例6: beforeEach

  beforeEach(() => {
    mockRadioButtonService = jasmine.createSpyObj('RadioButtonService', ['setSelected']);

    button = new RadioButton(mockRadioButtonService, Mocks.object('ThemeService'));
    TestDispose.add(button);
  });
开发者ID:garysoed,项目名称:gs-ui,代码行数:6,代码来源:radio-button_test.ts

示例7: beforeEach

 beforeEach(() => {
   tab = new VerticalTab(Mocks.object('ThemeService'));
   TestDispose.add(tab);
 });
开发者ID:garysoed,项目名称:gs-ui,代码行数:4,代码来源:vertical-tab_test.ts

示例8: assert

 assert(() => {
   TestDispose.add(Main.newInstance({}));
 }).toNot.throw();
开发者ID:garysoed,项目名称:gs-ui,代码行数:3,代码来源:main_test.ts

示例9: beforeEach

 beforeEach(() => {
   mockFileService = jasmine.createSpyObj('FileService', ['addBundle', 'getBundle']);
   input = new FileInput(mockFileService, Mocks.object('ThemeService'));
   TestDispose.add(input);
 });
开发者ID:garysoed,项目名称:gs-ui,代码行数:5,代码来源:file-input_test.ts

示例10: beforeEach

 beforeEach(() => {
   const mockThemeService = jasmine.createSpyObj('ThemeService', ['applyTheme']);
   input = new FloatInput(mockThemeService);
   TestDispose.add(input);
 });
开发者ID:garysoed,项目名称:gs-ui,代码行数:5,代码来源:float-input_test.ts


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