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

TypeScript router.convertToParamMap函数代码示例

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

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



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

示例1: it

  it('caches overlays when product unchanged', () => {
    const event = new Event({
      id: 'us0000test',
      properties: {
        products: {
          origin: [
            {
              properties: {
                latitude: '12',
                longitude: '13'
              }
            },
            {
              code: 'othercode',
              properties: {
                latitude: '14',
                longitude: '15'
              },
              source: 'othersource'
            }
          ]
        }
      }
    });
    const params = convertToParamMap({});
    const otherparams = convertToParamMap({
      epicenter: 'false',
      'origin-code': 'othercode',
      'origin-source': 'othersource'
    });

    pipe.overlayFactories = [
      { type: 'origin', pipe: new RegionInfoOverlaysPipe() }
    ];

    let overlays = pipe.transform(event, null);
    const epicenterOverlay = overlays.filter(overlay => {
      return overlay instanceof EpicenterOverlay;
    })[0];

    // same event, with params object that results in same product
    overlays = pipe.transform(event, params);
    expect(
      overlays.filter(overlay => {
        return overlay instanceof EpicenterOverlay;
      })[0]
    ).toBe(epicenterOverlay);

    // different params, should be different overlay
    overlays = pipe.transform(event, otherparams);
    const otherEpicenterOverlay = overlays.filter(overlay => {
      return overlay instanceof EpicenterOverlay;
    })[0];
    expect(otherEpicenterOverlay).not.toBe(epicenterOverlay);
    expect(otherEpicenterOverlay.enabled).toBeFalsy();
  });
开发者ID:ehunter-usgs,项目名称:earthquake-eventpages,代码行数:56,代码来源:interactive-map-overlays.pipe.spec.ts


示例2: beforeEach

 beforeEach(async(() => {
     TestBed.configureTestingModule({
         imports: [
             BrowserModule,
             RouterTestingModule,
             DragDropModule,
             MaterialModule,
             FormsModule,
             FormHelperModule,
             LayoutModule,
             ReactiveFormsModule,
             HttpClientTestingModule,
             NgxsModule.forRoot([AppState, SessionState]),
             NgxsFormPluginModule,
             NgProgressModule,
             NgProgressHttpModule,
             NoopAnimationsModule,
             ToastrModule.forRoot(),
         ],
         providers: [
             {
                 provide: ActivatedRoute,
                 useValue: {
                     paramMap: of(convertToParamMap({
                         storageId: 'storage-id',
                         type: RepositoryTypeEnum.HOSTED.toLowerCase()
                     }))
                 }
             }
         ],
         declarations: [ManageRepositoryComponent]
     }).compileComponents();
 }));
开发者ID:strongbox,项目名称:strongbox-web-ui,代码行数:33,代码来源:manage-repository.component.spec.ts


示例3: prepareModule

  function prepareModule(task: TaskModel, concernedPersonId: number) {
    const activatedRoute = {
      snapshot: {
        data: {
          persons,
          users,
          categories,
          task
        },
        paramMap: convertToParamMap(concernedPersonId ? {'concerned-person': concernedPersonId.toString()} : {})
      }
    } as any;

    TestBed.configureTestingModule({
      imports: [
        CurrentUserModule.forRoot(),
        ReactiveFormsModule,
        RouterTestingModule,
        GlobeNgbModule.forRoot(),
        HttpClientModule,
        ValdemortModule
      ],
      declarations: [TaskEditComponent, ValidationDefaultsComponent, PageTitleDirective],
      providers: [{ provide: ActivatedRoute, useValue: activatedRoute }]
    });

    TestBed.createComponent(ValidationDefaultsComponent).detectChanges();

    // different object on purpose
    TestBed.get(CurrentUserService).userEvents.next({id: 3, login: 'admin', admin: false});
  }
开发者ID:Ninja-Squad,项目名称:globe42,代码行数:31,代码来源:task-edit.component.spec.ts


示例4: beforeEach

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [
        TestsModule,
        TranslateModule.forRoot(),
        HeroesModule
      ],
      providers: [
        {provide: APP_CONFIG, useValue: AppConfig},
        {provide: APP_BASE_HREF, useValue: '/'},
        {
          provide: ActivatedRoute,
          useValue: {
            snapshot: {
              paramMap: convertToParamMap({
                id: '1'
              })
            }
          }
        },
        HeroService
      ],
    }).compileComponents();

    fixture = TestBed.createComponent(HeroDetailComponent);
    fixture.detectChanges();
    component = fixture.debugElement.componentInstance;
    heroService = TestBed.get(HeroService);
  }));
开发者ID:zach-luman,项目名称:angular6-example-app,代码行数:29,代码来源:hero-detail.component.spec.ts


示例5: beforeEach

 beforeEach(async(() => {
   TestBed.configureTestingModule({
     declarations: [ 
       PlayersListComponent 
     ],
     imports: [
       HttpClientTestingModule,
       NgbModule.forRoot(),
       ReactiveFormsModule,
       RouterTestingModule
     ],
     providers: [
       { 
         provide: ActivatedRoute,
         useValue: {
           snapshot: {
             paramMap: convertToParamMap({
               groupName: 'Under 10',
               yearOfBirth: '2008'
             })
           }
         }
       },
       NgbModal,
       PlayersService
     ]
   })
   .compileComponents();
 }));
开发者ID:emmettos,项目名称:CarraigOgRegister,代码行数:29,代码来源:players-list.component.spec.ts


示例6: beforeEach

 beforeEach(async(() => {
   TestBed.configureTestingModule({
     declarations: [
       MockComponent, 
       CreatePasswordComponent 
     ],
     imports: [
       HttpClientTestingModule,
       ReactiveFormsModule,
       RouterTestingModule.withRoutes([
         { path: "login", component: MockComponent }
       ])
     ],
     providers: [
       { 
         provide: ActivatedRoute,
         useValue: {
           snapshot: {
             paramMap: convertToParamMap({
               userToken: 'dummyToken'
             })
           }
         }
       },
       UserService,
       ValidationService
     ],
     schemas: [ 
       NO_ERRORS_SCHEMA 
     ]
   })
   .compileComponents();
 }));
开发者ID:emmettos,项目名称:CarraigOgRegister,代码行数:33,代码来源:create-password.component.spec.ts


示例7: it

 it('should resolve tasks when page is present', () => {
   const route = routeWithType('archived');
   (route as any).queryParamMap = convertToParamMap({page: '2'});
   const expected = of({} as Page<TaskModel>);
   spyOn(taskService, 'listArchived').and.returnValue(expected);
   expect(resolver.resolve(route)).toBe(expected);
   expect(taskService.listArchived).toHaveBeenCalledWith(2);
 });
开发者ID:Ninja-Squad,项目名称:globe42,代码行数:8,代码来源:tasks-resolver.service.spec.ts


示例8: it

  it('should have a title', () => {
    const participants = [] as Array<ParticipantModel>;
    dataSubject.next({ participants });
    paramMapSubject.next(convertToParamMap({ activityType : 'MEAL' }));

    fixture.detectChanges();
    expect(fixture.nativeElement.querySelector('h2').textContent).toBe('Participants aux activitĂŠs de type Repas');
  });
开发者ID:Ninja-Squad,项目名称:globe42,代码行数:8,代码来源:participants.component.spec.ts


示例9: it

 it('should resolve family when editing it', () => {
   const route = {
     paramMap: convertToParamMap({
       id: 42
     })
   } as ActivatedRouteSnapshot;
   expect(resolver.resolve(route)).toBe(family);
 });
开发者ID:Ninja-Squad,项目名称:globe42,代码行数:8,代码来源:family-resolver.service.spec.ts


示例10: routeWithType

 function routeWithType(personListType: string): ActivatedRouteSnapshot {
   const result: any = {
     data: {
       personListType
     },
     queryParamMap: convertToParamMap({})
   };
   return result;
 }
开发者ID:Ninja-Squad,项目名称:globe42,代码行数:9,代码来源:persons-resolver.service.spec.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript router.provideRouter函数代码示例发布时间:2022-05-28
下一篇:
TypeScript testing.withBody函数代码示例发布时间: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