1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import * as i0 from '@angular/core';
|
9 | import { InjectionToken } from '@angular/core';
|
10 | import { Location as Location_2 } from '@angular/common';
|
11 | import { LocationChangeListener } from '@angular/common';
|
12 | import { LocationStrategy } from '@angular/common';
|
13 | import { PlatformLocation } from '@angular/common';
|
14 | import { Provider } from '@angular/core';
|
15 | import { SubscriptionLike } from 'rxjs';
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | export declare const MOCK_PLATFORM_LOCATION_CONFIG: InjectionToken<MockPlatformLocationConfig>;
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export declare class MockLocationStrategy extends LocationStrategy {
|
31 | internalBaseHref: string;
|
32 | internalPath: string;
|
33 | internalTitle: string;
|
34 | urlChanges: string[];
|
35 | private stateChanges;
|
36 | constructor();
|
37 | simulatePopState(url: string): void;
|
38 | path(includeHash?: boolean): string;
|
39 | prepareExternalUrl(internal: string): string;
|
40 | pushState(ctx: any, title: string, path: string, query: string): void;
|
41 | replaceState(ctx: any, title: string, path: string, query: string): void;
|
42 | onPopState(fn: (value: any) => void): void;
|
43 | getBaseHref(): string;
|
44 | back(): void;
|
45 | forward(): void;
|
46 | getState(): unknown;
|
47 | static ɵfac: i0.ɵɵFactoryDeclaration<MockLocationStrategy, never>;
|
48 | static ɵprov: i0.ɵɵInjectableDeclaration<MockLocationStrategy>;
|
49 | }
|
50 |
|
51 | /**
|
52 | * Mock implementation of URL state.
|
53 | *
|
54 | * @publicApi
|
55 | */
|
56 | export declare class MockPlatformLocation implements PlatformLocation {
|
57 | private baseHref;
|
58 | private hashUpdate;
|
59 | private popStateSubject;
|
60 | private urlChangeIndex;
|
61 | private urlChanges;
|
62 | constructor(config?: MockPlatformLocationConfig);
|
63 | get hostname(): string;
|
64 | get protocol(): string;
|
65 | get port(): string;
|
66 | get pathname(): string;
|
67 | get search(): string;
|
68 | get hash(): string;
|
69 | get state(): unknown;
|
70 | getBaseHrefFromDOM(): string;
|
71 | onPopState(fn: LocationChangeListener): VoidFunction;
|
72 | onHashChange(fn: LocationChangeListener): VoidFunction;
|
73 | get href(): string;
|
74 | get url(): string;
|
75 | private parseChanges;
|
76 | replaceState(state: any, title: string, newUrl: string): void;
|
77 | pushState(state: any, title: string, newUrl: string): void;
|
78 | forward(): void;
|
79 | back(): void;
|
80 | historyGo(relativePosition?: number): void;
|
81 | getState(): unknown;
|
82 | /**
|
83 | * Browsers are inconsistent in when they fire events and perform the state updates
|
84 | * The most easiest thing to do in our mock is synchronous and that happens to match
|
85 | * Firefox and Chrome, at least somewhat closely
|
86 | *
|
87 | * https://github.com/WICG/navigation-api#watching-for-navigations
|
88 | * https://docs.google.com/document/d/1Pdve-DJ1JCGilj9Yqf5HxRJyBKSel5owgOvUJqTauwU/edit#heading=h.3ye4v71wsz94
|
89 | * popstate is always sent before hashchange:
|
90 | * https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent
|
91 | */
|
92 | private emitEvents;
|
93 | static ɵfac: i0.ɵɵFactoryDeclaration<MockPlatformLocation, [{ optional: true; }]>;
|
94 | static ɵprov: i0.ɵɵInjectableDeclaration<MockPlatformLocation>;
|
95 | }
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | export declare interface MockPlatformLocationConfig {
|
103 | startUrl?: string;
|
104 | appBaseHref?: string;
|
105 | }
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | export declare function provideLocationMocks(): Provider[];
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 | export declare class SpyLocation implements Location_2 {
|
121 | urlChanges: string[];
|
122 | private _history;
|
123 | private _historyIndex;
|
124 |
|
125 | ngOnDestroy(): void;
|
126 | setInitialPath(url: string): void;
|
127 | setBaseHref(url: string): void;
|
128 | path(): string;
|
129 | getState(): unknown;
|
130 | isCurrentPathEqualTo(path: string, query?: string): boolean;
|
131 | simulateUrlPop(pathname: string): void;
|
132 | simulateHashChange(pathname: string): void;
|
133 | prepareExternalUrl(url: string): string;
|
134 | go(path: string, query?: string, state?: any): void;
|
135 | replaceState(path: string, query?: string, state?: any): void;
|
136 | forward(): void;
|
137 | back(): void;
|
138 | historyGo(relativePosition?: number): void;
|
139 | onUrlChange(fn: (url: string, state: unknown) => void): VoidFunction;
|
140 | subscribe(onNext: (value: any) => void, onThrow?: ((error: any) => void) | null, onReturn?: (() => void) | null): SubscriptionLike;
|
141 | normalize(url: string): string;
|
142 | private pushHistory;
|
143 | static ɵfac: i0.ɵɵFactoryDeclaration<SpyLocation, never>;
|
144 | static ɵprov: i0.ɵɵInjectableDeclaration<SpyLocation>;
|
145 | }
|
146 |
|
147 | /**
|
148 | * Return a provider for the `FakeNavigation` in place of the real Navigation API.
|
149 | */
|
150 | export declare function ɵprovideFakePlatformNavigation(): Provider[];
|
151 |
|
152 | export { }
|
153 |
|
\ | No newline at end of file |