本文整理汇总了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();
});
示例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();
}));
示例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});
}
示例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);
}));
示例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();
}));
示例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();
}));
示例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);
});
示例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');
});
示例9: it
it('should resolve family when editing it', () => {
const route = {
paramMap: convertToParamMap({
id: 42
})
} as ActivatedRouteSnapshot;
expect(resolver.resolve(route)).toBe(family);
});
示例10: routeWithType
function routeWithType(personListType: string): ActivatedRouteSnapshot {
const result: any = {
data: {
personListType
},
queryParamMap: convertToParamMap({})
};
return result;
}