SpyLocation
A spy for Location
that allows tests to fire simulated location events.
class SpyLocation implements Location {
urlChanges: string[]
setInitialPath(url: string)
setBaseHref(url: string)
path(): string
getState(): unknown
isCurrentPathEqualTo(path: string, query: string = ''): boolean
simulateUrlPop(pathname: string)
simulateHashChange(pathname: string)
prepareExternalUrl(url: string): string
go(path: string, query: string = '', state: any = null)
replaceState(path: string, query: string = '', state: any = null)
forward()
back()
historyGo(relativePosition: number = 0): void
onUrlChange(fn: (url: string, state: unknown) => void): VoidFunction
subscribe(onNext: (value: any) => void, onThrow?: (error: any) => void, onReturn?: () => void): SubscriptionLike
normalize(url: string): string
}
Properties
Property | Description |
---|---|
urlChanges: string[]
|
Methods
setInitialPath() |
---|
setBaseHref() |
---|
path() |
---|
ParametersThere are no parameters. Returns
|
getState() |
---|
ParametersThere are no parameters. Returns
|
isCurrentPathEqualTo() |
---|
simulateUrlPop() |
---|
simulateHashChange() |
---|
prepareExternalUrl() |
---|
go() |
---|
replaceState() |
---|
forward() |
---|
ParametersThere are no parameters. |
back() |
---|
ParametersThere are no parameters. |
historyGo() |
---|
onUrlChange() |
---|
subscribe() |
---|
normalize() |
---|