1 | /**
|
---|
2 | * @license Angular v12.2.9
|
---|
3 | * (c) 2010-2021 Google LLC. https://angular.io/
|
---|
4 | * License: MIT
|
---|
5 | */
|
---|
6 |
|
---|
7 | import { InjectionToken } from '@angular/core';
|
---|
8 | import { Location as Location_2 } from '@angular/common';
|
---|
9 | import { LocationChangeListener } from '@angular/common';
|
---|
10 | import { LocationStrategy } from '@angular/common';
|
---|
11 | import { PlatformLocation } from '@angular/common';
|
---|
12 | import { SubscriptionLike } from 'rxjs';
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Provider for mock platform location config
|
---|
16 | *
|
---|
17 | * @publicApi
|
---|
18 | */
|
---|
19 | export declare const MOCK_PLATFORM_LOCATION_CONFIG: InjectionToken<MockPlatformLocationConfig>;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * A mock implementation of {@link LocationStrategy} that allows tests to fire simulated
|
---|
23 | * location events.
|
---|
24 | *
|
---|
25 | * @publicApi
|
---|
26 | */
|
---|
27 | export declare class MockLocationStrategy extends LocationStrategy {
|
---|
28 | internalBaseHref: string;
|
---|
29 | internalPath: string;
|
---|
30 | internalTitle: string;
|
---|
31 | urlChanges: string[];
|
---|
32 | private stateChanges;
|
---|
33 | constructor();
|
---|
34 | simulatePopState(url: string): void;
|
---|
35 | path(includeHash?: boolean): string;
|
---|
36 | prepareExternalUrl(internal: string): string;
|
---|
37 | pushState(ctx: any, title: string, path: string, query: string): void;
|
---|
38 | replaceState(ctx: any, title: string, path: string, query: string): void;
|
---|
39 | onPopState(fn: (value: any) => void): void;
|
---|
40 | getBaseHref(): string;
|
---|
41 | back(): void;
|
---|
42 | forward(): void;
|
---|
43 | getState(): unknown;
|
---|
44 | }
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * Mock implementation of URL state.
|
---|
48 | *
|
---|
49 | * @publicApi
|
---|
50 | */
|
---|
51 | export declare class MockPlatformLocation implements PlatformLocation {
|
---|
52 | private baseHref;
|
---|
53 | private hashUpdate;
|
---|
54 | private urlChangeIndex;
|
---|
55 | private urlChanges;
|
---|
56 | constructor(config?: MockPlatformLocationConfig);
|
---|
57 | get hostname(): string;
|
---|
58 | get protocol(): string;
|
---|
59 | get port(): string;
|
---|
60 | get pathname(): string;
|
---|
61 | get search(): string;
|
---|
62 | get hash(): string;
|
---|
63 | get state(): unknown;
|
---|
64 | getBaseHrefFromDOM(): string;
|
---|
65 | onPopState(fn: LocationChangeListener): VoidFunction;
|
---|
66 | onHashChange(fn: LocationChangeListener): VoidFunction;
|
---|
67 | get href(): string;
|
---|
68 | get url(): string;
|
---|
69 | private parseChanges;
|
---|
70 | replaceState(state: any, title: string, newUrl: string): void;
|
---|
71 | pushState(state: any, title: string, newUrl: string): void;
|
---|
72 | forward(): void;
|
---|
73 | back(): void;
|
---|
74 | historyGo(relativePosition?: number): void;
|
---|
75 | getState(): unknown;
|
---|
76 | private scheduleHashUpdate;
|
---|
77 | }
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Mock platform location config
|
---|
81 | *
|
---|
82 | * @publicApi
|
---|
83 | */
|
---|
84 | export declare interface MockPlatformLocationConfig {
|
---|
85 | startUrl?: string;
|
---|
86 | appBaseHref?: string;
|
---|
87 | }
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * A spy for {@link Location} that allows tests to fire simulated location events.
|
---|
91 | *
|
---|
92 | * @publicApi
|
---|
93 | */
|
---|
94 | export declare class SpyLocation implements Location_2 {
|
---|
95 | urlChanges: string[];
|
---|
96 | private _history;
|
---|
97 | private _historyIndex;
|
---|
98 | setInitialPath(url: string): void;
|
---|
99 | setBaseHref(url: string): void;
|
---|
100 | path(): string;
|
---|
101 | getState(): unknown;
|
---|
102 | isCurrentPathEqualTo(path: string, query?: string): boolean;
|
---|
103 | simulateUrlPop(pathname: string): void;
|
---|
104 | simulateHashChange(pathname: string): void;
|
---|
105 | prepareExternalUrl(url: string): string;
|
---|
106 | go(path: string, query?: string, state?: any): void;
|
---|
107 | replaceState(path: string, query?: string, state?: any): void;
|
---|
108 | forward(): void;
|
---|
109 | back(): void;
|
---|
110 | historyGo(relativePosition?: number): void;
|
---|
111 | onUrlChange(fn: (url: string, state: unknown) => void): void;
|
---|
112 | subscribe(onNext: (value: any) => void, onThrow?: ((error: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike;
|
---|
113 | normalize(url: string): string;
|
---|
114 | }
|
---|
115 |
|
---|
116 | export { }
|
---|