• 概要
@angular/common/testing

MockPlatformLocation

Class
stable

Mock implementation of URL state.

API

    
      class MockPlatformLocation implements PlatformLocation {  constructor(config?: MockPlatformLocationConfig | undefined): MockPlatformLocation;  readonly hostname: string;  readonly protocol: string;  readonly port: string;  readonly pathname: string;  readonly search: string;  readonly hash: string;  readonly state: unknown;  getBaseHrefFromDOM(): string;  onPopState(fn: LocationChangeListener): VoidFunction;  onHashChange(fn: LocationChangeListener): VoidFunction;  readonly href: string;  readonly url: string;  replaceState(state: any, title: string, newUrl: string): void;  pushState(state: any, title: string, newUrl: string): void;  forward(): void;  back(): void;  historyGo(relativePosition?: number): void;  getState(): unknown;}
    
    

hostname

string

protocol

string

port

string

pathname

string

hash

string

state

unknown

getBaseHrefFromDOM

string
@returnsstring

onPopState

VoidFunction
@paramfnLocationChangeListener
@returnsVoidFunction

onHashChange

VoidFunction
@paramfnLocationChangeListener
@returnsVoidFunction

href

string

url

string

replaceState

void
@paramstateany
@paramtitlestring
@paramnewUrlstring
@returnsvoid

pushState

void
@paramstateany
@paramtitlestring
@paramnewUrlstring
@returnsvoid

forward

void
@returnsvoid

back

void
@returnsvoid

historyGo

void
@paramrelativePositionnumber
@returnsvoid

getState

unknown
@returnsunknown
Jump to details