MockPlatformLocation
From Get docs
< @angular/common | testingAngular/docs/latest/api/common/testing/mockplatformlocation
MockPlatformLocation
class
Mock implementation of URL state.
class MockPlatformLocation implements PlatformLocation {
hostname
protocol
port
pathname
search
hash
state
href: string
url: string
getBaseHrefFromDOM(): string
onPopState(fn: LocationChangeListener): VoidFunction
onHashChange(fn: LocationChangeListener): VoidFunction
replaceState(state: any, title: string, newUrl: string): void
pushState(state: any, title: string, newUrl: string): void
forward(): void
back(): void
historyGo(relativePosition: number = 0): void
getState(): unknown
}
Properties
Property | Description |
---|---|
hostname
|
Read-Only |
protocol
|
Read-Only |
port
|
Read-Only |
pathname
|
Read-Only |
search
|
Read-Only |
hash
|
Read-Only |
state
|
Read-Only |
href: string
|
Read-Only |
url: string
|
Read-Only |
Methods
getBaseHrefFromDOM() |
---|
getBaseHrefFromDOM(): stringParametersThere are no parameters. Returns
|
onPopState() | |||
---|---|---|---|
onPopState(fn: LocationChangeListener): VoidFunctionParameters
Returns
|
onHashChange() | |||
---|---|---|---|
onHashChange(fn: LocationChangeListener): VoidFunctionParameters
Returns
|
replaceState() | |||||||||
---|---|---|---|---|---|---|---|---|---|
replaceState(state: any, title: string, newUrl: string): voidParameters
Returns
|
pushState() | |||||||||
---|---|---|---|---|---|---|---|---|---|
pushState(state: any, title: string, newUrl: string): voidParameters
Returns
|
forward() |
---|
forward(): voidParametersThere are no parameters. Returns
|
back() |
---|
back(): voidParametersThere are no parameters. Returns
|
historyGo() | |||
---|---|---|---|
historyGo(relativePosition: number = 0): voidParameters
Returns
|
getState() |
---|
getState(): unknownParametersThere are no parameters. Returns
|
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/common/testing/MockPlatformLocation