A mock implementation of LocationStrategy
that allows tests to fire simulated
location events.
class
MockLocationStrategy extends
LocationStrategy {
internalBaseHref: string
internalPath: string
internalTitle: string
urlChanges: string[]
simulatePopState(url: string): void
path(includeHash: boolean = false): 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
// inherited from
common/LocationStrategy
abstract path(includeHash?: boolean): string
abstract prepareExternalUrl(internal: string): string
abstract pushState(state: any, title: string, url: string, queryParams: string): void
abstract replaceState(state: any, title: string, url: string, queryParams: string): void
abstract forward(): void
abstract back(): void
abstract onPopState(fn: LocationChangeListener): void
abstract getBaseHref(): string
}
class MockLocationStrategy extends LocationStrategy {
internalBaseHref: string
internalPath: string
internalTitle: string
urlChanges: string[]
simulatePopState(url: string): void
path(includeHash: boolean = false): 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
// inherited from common/LocationStrategy
abstract path(includeHash?: boolean): string
abstract prepareExternalUrl(internal: string): string
abstract pushState(state: any, title: string, url: string, queryParams: string): void
abstract replaceState(state: any, title: string, url: string, queryParams: string): void
abstract forward(): void
abstract back(): void
abstract onPopState(fn: LocationChangeListener): void
abstract getBaseHref(): string
}
Methods
|
simulatePopState(url: string): void
simulatePopState(url: string): void
Parameters
Returns
void
|
|
path(includeHash: boolean = false): string
path(includeHash: boolean = false): string
Parameters
includeHash |
Type: boolean .
Optional. Default is false .
|
Returns
string
|
|
prepareExternalUrl(internal: string): string
prepareExternalUrl(internal: string): string
Parameters
Returns
string
|
|
pushState(ctx: any, title: string, path: string, query: string): void
pushState(ctx: any, title: string, path: string, query: string): void
Parameters
ctx |
Type: any .
|
title |
Type: string .
|
path |
Type: string .
|
query |
Type: string .
|
Returns
void
|
|
replaceState(ctx: any, title: string, path: string, query: string): void
replaceState(ctx: any, title: string, path: string, query: string): void
Parameters
ctx |
Type: any .
|
title |
Type: string .
|
path |
Type: string .
|
query |
Type: string .
|
Returns
void
|
|
onPopState(fn: (value: any) => void): void
onPopState(fn: (value: any) => void): void
Parameters
fn |
Type: (value: any) => void .
|
Returns
void
|
|
getBaseHref(): string
getBaseHref(): string
Parameters
There are no parameters.
Returns
string
|
|
back(): void
back(): void
Parameters
There are no parameters.
Returns
void
|
|
forward(): void
forward(): void
Parameters
There are no parameters.
Returns
void
|