• 概要
@angular/common/testing

MockLocationStrategy

Class
stable

A mock implementation of LocationStrategy that allows tests to fire simulated location events.

API

    
      class MockLocationStrategy extends LocationStrategy {  internalBaseHref: string;  internalPath: string;  internalTitle: string;  urlChanges: string[];  simulatePopState(url: string): void;  path(includeHash?: boolean): string;  prepareExternalUrl(internal: string): string;  pushState(ctx: any, title: string, path: string, query: string): void;  replaceState(ctx: any, title: string, path: string, query: string): void;  onPopState(fn: (value: any) => void): void;  getBaseHref(): string;  back(): void;  forward(): void;  getState(): unknown;  optional override historyGo(relativePosition: number): void;}
    
    

internalBaseHref

string

internalPath

string

internalTitle

string

urlChanges

string[]

simulatePopState

void
@paramurlstring
@returnsvoid

path

string
@paramincludeHashboolean
@returnsstring

prepareExternalUrl

string
@paraminternalstring
@returnsstring

pushState

void
@paramctxany
@paramtitlestring
@parampathstring
@paramquerystring
@returnsvoid

replaceState

void
@paramctxany
@paramtitlestring
@parampathstring
@paramquerystring
@returnsvoid

onPopState

void
@paramfn(value: any) => void
@returnsvoid

getBaseHref

string
@returnsstring

back

void
@returnsvoid

forward

void
@returnsvoid

getState

unknown
@returnsunknown

historyGo

void
@paramrelativePositionnumber
@returnsvoid
Jump to details