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


TypeScript immutable.ImmutableList类代码示例

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


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

示例1: it

    it('should set the correct target element to active', () => {
      const rootEl = Mocks.object('rootEl');
      const fullPath = 'fullPath';

      const slotName = 'slotName';
      const path = 'path';
      const childWithPath = document.createElement('div');
      childWithPath.setAttribute('gs-view-path', path);
      childWithPath.setAttribute('slot', slotName);

      const childNoPath = document.createElement('div');

      const element = document.createElement('div');
      element.appendChild(childNoPath);
      element.appendChild(childWithPath);
      element[__fullPath] = fullPath;

      const appendedPath = 'appendedPath';
      spyOn(LocationService, 'appendParts').and.returnValue(appendedPath);

      spyOn(LocationService, 'hasMatch').and.returnValue(true);

      spyOn(viewSlot, 'setRootElVisible_');

      const fakeSwitchValueSetter = new FakeMonadSetter<string | null>(null);

      const updates = viewSlot.updateActiveView_(element, rootEl, fakeSwitchValueSetter);
      assert(fakeSwitchValueSetter.findValue(updates)!.value).to.equal(slotName);
      assert(viewSlot['setRootElVisible_']).to.haveBeenCalledWith(rootEl, true);
      assert(LocationService.appendParts).to.haveBeenCalledWith(ImmutableList.of([fullPath, path]));
      assert(LocationService.hasMatch).to.haveBeenCalledWith(appendedPath);
      assert(childWithPath.getAttribute('gs-view-active')).to.equal('true');
    });
开发者ID:garysoed,项目名称:gs-ui,代码行数:33,代码来源:view-slot_test.ts

示例2: it

    it('should return true if every item has one of the specified mime type', () => {
      const mimeType1 = 'mimeType1';
      const mimeType2 = 'mimeType2';

      const dataTransfer = Mocks.object('dataTransfer');
      dataTransfer.items = [{type: mimeType1}, {type: mimeType2}];

      assert(input['isValid_'](ImmutableList.of([mimeType1, mimeType2]), dataTransfer)).to.beTrue();
    });
开发者ID:garysoed,项目名称:gs-ui,代码行数:9,代码来源:file-input_test.ts

示例3: getCascadePaths

 /**
  * @param params Params to create the paths.
  * @return Array of paths for the current route and its ancestors. The oldest ancestors come
  *    first in the array.
  */
 getCascadePaths(params: CR): string[] {
   const paths: string[] = [];
   let current: AbstractRouteFactory<any, any, any, any> | null = this;
   while (current !== null) {
     paths.push(current.getPath(params));
     current = current.parent_;
   }
   return [...ImmutableList.of(paths).reverse()];
 }
开发者ID:garysoed,项目名称:gs-ui,代码行数:14,代码来源:abstract-route-factory.ts

示例4: getCascadeNames

 /**
  * @param params Params to determine the name of the route.
  * @return Array of names of the current route and its ancestors. The oldest ancestors come
  *    first in the array.
  */
 getCascadeNames(params: CR): Promise<string>[] {
   const names: Promise<string>[] = [];
   let current: AbstractRouteFactory<any, any, any, any> | null = this;
   while (current !== null) {
     names.push(current.getName(params));
     current = current.parent_;
   }
   return [...ImmutableList.of(names).reverse()];
 }
开发者ID:garysoed,项目名称:gs-ui,代码行数:14,代码来源:abstract-route-factory.ts

示例5: getCascadeCrumbs

 async getCascadeCrumbs(params: CR): Promise<{name: string, url: string}[]> {
   const crumbs: {name: string, url: string}[] = [];
   let current: AbstractRouteFactory<any, any, any, any> | null = this;
   while (current !== null) {
     crumbs.push({
       name: await current.getName(params),
       url: current.getPath(params),
     });
     current = current.parent_;
   }
   return [...ImmutableList.of(crumbs).reverse()];
 }
开发者ID:garysoed,项目名称:gs-ui,代码行数:12,代码来源:abstract-route-factory.ts

示例6: it

  it(`should return the correct map`, () => {
    const type1 = Mocks.object('type1');
    const mockFactory1 = jasmine.createSpyObj('Factory1', ['getType']);
    mockFactory1.getType.and.returnValue(type1);

    const type2 = Mocks.object('type2');
    const mockFactory2 = jasmine.createSpyObj('Factory2', ['getType']);
    mockFactory2.getType.and.returnValue(type2);

    const routeFactories = ImmutableList.of([mockFactory1, mockFactory2]);

    assert(providesRouteFactoryMap(routeFactories)).to.haveElements([
      [type1, mockFactory1],
      [type2, mockFactory2],
    ]);
  });
开发者ID:garysoed,项目名称:gs-ui,代码行数:16,代码来源:route-graph_test.ts


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