SpyLocation
class
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 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() subscribe(onNext: (value: any) => void, onThrow?: ((error: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike normalize(url: string): string }
Properties
Property | Description |
---|---|
urlChanges: string[] |
Methods
setInitialPath()
|
||
---|---|---|
|
url | Type: |
setBaseHref()
|
||
---|---|---|
|
url | Type: |
path()
|
---|
|
isCurrentPathEqualTo()
|
||||
---|---|---|---|---|
|
path | Type: |
query | Type: Optional. Default is |
Returns
boolean
simulateUrlPop()
|
||
---|---|---|
|
pathname | Type: |
simulateHashChange()
|
||
---|---|---|
|
pathname | Type: |
prepareExternalUrl()
|
||
---|---|---|
|
url | Type: |
Returns
string
go()
|
||||||
---|---|---|---|---|---|---|
|
path | Type: |
query | Type: Optional. Default is |
state | Type: Optional. Default is |
replaceState()
|
||||||
---|---|---|---|---|---|---|
|
path | Type: |
query | Type: Optional. Default is |
state | Type: Optional. Default is |
forward()
|
---|
|
back()
|
---|
|
subscribe()
|
||||||
---|---|---|---|---|---|---|
|
onNext | Type: |
onThrow | Type: Optional. Default is |
onReturn | Type: Optional. Default is |
Returns
SubscriptionLike
normalize()
|
||
---|---|---|
|
url | Type: |
Returns
string
© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v6.angular.io/api/common/testing/SpyLocation