@angular/router 13.0.0-next.0 → 13.0.0-next.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  2. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  3. package/esm2020/router.mjs +5 -0
  4. package/{esm2015/src/apply_redirects.js → esm2020/src/apply_redirects.mjs} +0 -0
  5. package/esm2020/src/components/empty_outlet.mjs +29 -0
  6. package/esm2020/src/config.mjs +14 -0
  7. package/{esm2015/src/create_router_state.js → esm2020/src/create_router_state.mjs} +0 -0
  8. package/{esm2015/src/create_url_tree.js → esm2020/src/create_url_tree.mjs} +0 -0
  9. package/esm2020/src/directives/router_link.mjs +353 -0
  10. package/esm2020/src/directives/router_link_active.mjs +215 -0
  11. package/esm2020/src/directives/router_outlet.mjs +219 -0
  12. package/{esm2015/src/events.js → esm2020/src/events.mjs} +1 -1
  13. package/{esm2015/src/index.js → esm2020/src/index.mjs} +1 -1
  14. package/{esm2015/src/interfaces.js → esm2020/src/interfaces.mjs} +1 -1
  15. package/{esm2015/src/operators/activate_routes.js → esm2020/src/operators/activate_routes.mjs} +0 -0
  16. package/esm2020/src/operators/apply_redirects.mjs +14 -0
  17. package/esm2020/src/operators/check_guards.mjs +138 -0
  18. package/{esm2015/src/operators/prioritized_guard_value.js → esm2020/src/operators/prioritized_guard_value.mjs} +0 -0
  19. package/esm2020/src/operators/recognize.mjs +14 -0
  20. package/esm2020/src/operators/resolve_data.mjs +59 -0
  21. package/{esm2015/src/operators/switch_tap.js → esm2020/src/operators/switch_tap.mjs} +0 -0
  22. package/{esm2015/src/private_export.js → esm2020/src/private_export.mjs} +0 -0
  23. package/esm2020/src/recognize.mjs +262 -0
  24. package/{esm2015/src/route_reuse_strategy.js → esm2020/src/route_reuse_strategy.mjs} +0 -0
  25. package/esm2020/src/router.mjs +1009 -0
  26. package/esm2020/src/router_config_loader.mjs +71 -0
  27. package/esm2020/src/router_module.mjs +367 -0
  28. package/esm2020/src/router_outlet_context.mjs +74 -0
  29. package/esm2020/src/router_preloader.mjs +127 -0
  30. package/esm2020/src/router_scroller.mjs +95 -0
  31. package/esm2020/src/router_state.mjs +404 -0
  32. package/{esm2015/src/shared.js → esm2020/src/shared.mjs} +0 -0
  33. package/{esm2015/src/url_handling_strategy.js → esm2020/src/url_handling_strategy.mjs} +0 -0
  34. package/{esm2015/src/url_tree.js → esm2020/src/url_tree.mjs} +2 -2
  35. package/{esm2015/src/utils/collection.js → esm2020/src/utils/collection.mjs} +0 -0
  36. package/{esm2015/src/utils/config.js → esm2020/src/utils/config.mjs} +2 -2
  37. package/esm2020/src/utils/config_matching.mjs +145 -0
  38. package/{esm2015/src/utils/preactivation.js → esm2020/src/utils/preactivation.mjs} +0 -0
  39. package/{esm2015/src/utils/tree.js → esm2020/src/utils/tree.mjs} +0 -0
  40. package/{esm2015/src/utils/type_guards.js → esm2020/src/utils/type_guards.mjs} +0 -0
  41. package/{esm2015/src/version.js → esm2020/src/version.mjs} +1 -1
  42. package/{esm2015/testing/index.js → esm2020/testing/index.mjs} +0 -0
  43. package/{esm2015/testing/public_api.js → esm2020/testing/public_api.mjs} +0 -0
  44. package/esm2020/testing/src/extra_router_testing_providers.mjs +10 -0
  45. package/esm2020/testing/src/router_testing_module.mjs +122 -0
  46. package/esm2020/testing/src/spy_ng_module_factory_loader.mjs +10 -0
  47. package/esm2020/testing/src/testing.mjs +15 -0
  48. package/{esm2015/testing/testing.js → esm2020/testing/testing.mjs} +0 -0
  49. package/{esm2015/upgrade/index.js → esm2020/upgrade/index.mjs} +0 -0
  50. package/{esm2015/upgrade/public_api.js → esm2020/upgrade/public_api.mjs} +0 -0
  51. package/esm2020/upgrade/src/upgrade.mjs +120 -0
  52. package/{esm2015/upgrade/upgrade.js → esm2020/upgrade/upgrade.mjs} +0 -0
  53. package/fesm2015/{router.js → router.mjs} +626 -581
  54. package/fesm2015/router.mjs.map +1 -0
  55. package/fesm2015/testing.mjs +179 -0
  56. package/fesm2015/testing.mjs.map +1 -0
  57. package/fesm2015/{upgrade.js → upgrade.mjs} +4 -5
  58. package/fesm2015/upgrade.mjs.map +1 -0
  59. package/fesm2020/router.mjs +6163 -0
  60. package/fesm2020/router.mjs.map +1 -0
  61. package/fesm2020/testing.mjs +179 -0
  62. package/fesm2020/testing.mjs.map +1 -0
  63. package/fesm2020/upgrade.mjs +150 -0
  64. package/fesm2020/upgrade.mjs.map +1 -0
  65. package/package.json +34 -10
  66. package/router.d.ts +186 -143
  67. package/testing/package.json +5 -5
  68. package/testing/testing.d.ts +9 -66
  69. package/upgrade/package.json +5 -5
  70. package/upgrade/upgrade.d.ts +1 -1
  71. package/bundles/router-testing.umd.js +0 -541
  72. package/bundles/router-testing.umd.js.map +0 -1
  73. package/bundles/router-upgrade.umd.js +0 -157
  74. package/bundles/router-upgrade.umd.js.map +0 -1
  75. package/bundles/router.umd.js +0 -6840
  76. package/bundles/router.umd.js.map +0 -1
  77. package/esm2015/router.externs.js +0 -6
  78. package/esm2015/router.js +0 -9
  79. package/esm2015/src/components/empty_outlet.js +0 -24
  80. package/esm2015/src/config.js +0 -14
  81. package/esm2015/src/directives/router_link.js +0 -293
  82. package/esm2015/src/directives/router_link_active.js +0 -184
  83. package/esm2015/src/directives/router_outlet.js +0 -193
  84. package/esm2015/src/operators/apply_redirects.js +0 -14
  85. package/esm2015/src/operators/check_guards.js +0 -138
  86. package/esm2015/src/operators/recognize.js +0 -14
  87. package/esm2015/src/operators/resolve_data.js +0 -56
  88. package/esm2015/src/recognize.js +0 -262
  89. package/esm2015/src/router.js +0 -1046
  90. package/esm2015/src/router_config_loader.js +0 -76
  91. package/esm2015/src/router_module.js +0 -363
  92. package/esm2015/src/router_outlet_context.js +0 -73
  93. package/esm2015/src/router_preloader.js +0 -130
  94. package/esm2015/src/router_scroller.js +0 -95
  95. package/esm2015/src/router_state.js +0 -404
  96. package/esm2015/src/utils/config_matching.js +0 -145
  97. package/esm2015/testing/src/router_testing_module.js +0 -166
  98. package/esm2015/testing/src/testing.js +0 -14
  99. package/esm2015/testing/testing.externs.js +0 -6
  100. package/esm2015/upgrade/src/upgrade.js +0 -122
  101. package/esm2015/upgrade/upgrade.externs.js +0 -6
  102. package/fesm2015/router.js.map +0 -1
  103. package/fesm2015/testing.js +0 -204
  104. package/fesm2015/testing.js.map +0 -1
  105. package/fesm2015/upgrade.js.map +0 -1
  106. package/router.metadata.json +0 -1
  107. package/testing/testing.metadata.json +0 -1
  108. package/testing.d.ts +0 -7
  109. package/testing.metadata.json +0 -1
  110. package/upgrade/upgrade.metadata.json +0 -1
  111. package/upgrade.d.ts +0 -7
  112. package/upgrade.metadata.json +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.0.0-next.0
2
+ * @license Angular v13.0.0-next.12
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7,13 +7,14 @@
7
7
  import { ChildrenOutletContexts } from '@angular/router';
8
8
  import { Compiler } from '@angular/core';
9
9
  import { ExtraOptions } from '@angular/router';
10
+ import * as i0 from '@angular/core';
11
+ import * as i1 from '@angular/router';
10
12
  import { Injector } from '@angular/core';
11
13
  import { Location as Location_2 } from '@angular/common';
12
14
  import { ModuleWithProviders } from '@angular/core';
13
- import { NgModuleFactory } from '@angular/core';
14
- import { NgModuleFactoryLoader } from '@angular/core';
15
15
  import { Route } from '@angular/router';
16
16
  import { Router } from '@angular/router';
17
+ import { RouteReuseStrategy } from '@angular/router';
17
18
  import { Routes } from '@angular/router';
18
19
  import { UrlHandlingStrategy } from '@angular/router';
19
20
  import { UrlSerializer } from '@angular/router';
@@ -24,8 +25,7 @@ import { UrlSerializer } from '@angular/router';
24
25
  * Sets up the router to be used for testing.
25
26
  *
26
27
  * The modules sets up the router to be used for testing.
27
- * It provides spy implementations of `Location`, `LocationStrategy`, and {@link
28
- * NgModuleFactoryLoader}.
28
+ * It provides spy implementations of `Location` and `LocationStrategy`.
29
29
  *
30
30
  * @usageNotes
31
31
  * ### Example
@@ -46,6 +46,9 @@ import { UrlSerializer } from '@angular/router';
46
46
  */
47
47
  export declare class RouterTestingModule {
48
48
  static withRoutes(routes: Routes, config?: ExtraOptions): ModuleWithProviders<RouterTestingModule>;
49
+ static ɵfac: i0.ɵɵFactoryDeclaration<RouterTestingModule, never>;
50
+ static ɵmod: i0.ɵɵNgModuleDeclaration<RouterTestingModule, never, never, [typeof i1.RouterModule]>;
51
+ static ɵinj: i0.ɵɵInjectorDeclaration<RouterTestingModule>;
49
52
  }
50
53
 
51
54
  /**
@@ -53,66 +56,6 @@ export declare class RouterTestingModule {
53
56
  *
54
57
  * @publicApi
55
58
  */
56
- export declare function setupTestingRouter(urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location_2, loader: NgModuleFactoryLoader, compiler: Compiler, injector: Injector, routes: Route[][], opts?: ExtraOptions, urlHandlingStrategy?: UrlHandlingStrategy): Router;
57
-
58
- /**
59
- * Router setup factory function used for testing.
60
- *
61
- * @deprecated As of v5.2. The 2nd-to-last argument should be `ExtraOptions`, not
62
- * `UrlHandlingStrategy`
63
- * @publicApi
64
- */
65
- export declare function setupTestingRouter(urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location_2, loader: NgModuleFactoryLoader, compiler: Compiler, injector: Injector, routes: Route[][], urlHandlingStrategy?: UrlHandlingStrategy): Router;
66
-
67
- /**
68
- * @description
69
- *
70
- * Allows to simulate the loading of ng modules in tests.
71
- *
72
- * ```
73
- * const loader = TestBed.inject(NgModuleFactoryLoader);
74
- *
75
- * @Component({template: 'lazy-loaded'})
76
- * class LazyLoadedComponent {}
77
- * @NgModule({
78
- * declarations: [LazyLoadedComponent],
79
- * imports: [RouterModule.forChild([{path: 'loaded', component: LazyLoadedComponent}])]
80
- * })
81
- *
82
- * class LoadedModule {}
83
- *
84
- * // sets up stubbedModules
85
- * loader.stubbedModules = {lazyModule: LoadedModule};
86
- *
87
- * router.resetConfig([
88
- * {path: 'lazy', loadChildren: 'lazyModule'},
89
- * ]);
90
- *
91
- * router.navigateByUrl('/lazy/loaded');
92
- * ```
93
- *
94
- * @publicApi
95
- */
96
- export declare class SpyNgModuleFactoryLoader implements NgModuleFactoryLoader {
97
- private compiler;
98
- /**
99
- * @docsNotRequired
100
- */
101
- private _stubbedModules;
102
- /**
103
- * @docsNotRequired
104
- */
105
- set stubbedModules(modules: {
106
- [path: string]: any;
107
- });
108
- /**
109
- * @docsNotRequired
110
- */
111
- get stubbedModules(): {
112
- [path: string]: any;
113
- };
114
- constructor(compiler: Compiler);
115
- load(path: string): Promise<NgModuleFactory<any>>;
116
- }
59
+ export declare function setupTestingRouter(urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location_2, compiler: Compiler, injector: Injector, routes: Route[][], opts?: ExtraOptions | UrlHandlingStrategy, urlHandlingStrategy?: UrlHandlingStrategy, routeReuseStrategy?: RouteReuseStrategy): Router;
117
60
 
118
61
  export { }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@angular/router/upgrade",
3
3
  "sideEffects": false,
4
- "main": "../bundles/router-upgrade.umd.js",
5
- "fesm2015": "../fesm2015/upgrade.js",
6
- "esm2015": "../esm2015/upgrade/upgrade.js",
4
+ "fesm2020": "../fesm2020/upgrade.mjs",
5
+ "fesm2015": "../fesm2015/upgrade.mjs",
6
+ "esm2020": "../esm2020/upgrade/upgrade.mjs",
7
7
  "typings": "./upgrade.d.ts",
8
- "module": "../fesm2015/upgrade.js",
9
- "es2015": "../fesm2015/upgrade.js"
8
+ "module": "../fesm2015/upgrade.mjs",
9
+ "es2020": "../fesm2020/upgrade.mjs"
10
10
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.0.0-next.0
2
+ * @license Angular v13.0.0-next.12
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,541 +0,0 @@
1
- /**
2
- * @license Angular v13.0.0-next.0
3
- * (c) 2010-2021 Google LLC. https://angular.io/
4
- * License: MIT
5
- */
6
-
7
- (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/common/testing'), require('@angular/core'), require('@angular/router')) :
9
- typeof define === 'function' && define.amd ? define('@angular/router/testing', ['exports', '@angular/common', '@angular/common/testing', '@angular/core', '@angular/router'], factory) :
10
- (global = global || self, factory((global.ng = global.ng || {}, global.ng.router = global.ng.router || {}, global.ng.router.testing = {}), global.ng.common, global.ng.common.testing, global.ng.core, global.ng.router));
11
- }(this, (function (exports, common, testing, core, router) { 'use strict';
12
-
13
- /*! *****************************************************************************
14
- Copyright (c) Microsoft Corporation.
15
-
16
- Permission to use, copy, modify, and/or distribute this software for any
17
- purpose with or without fee is hereby granted.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
21
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
22
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
- PERFORMANCE OF THIS SOFTWARE.
26
- ***************************************************************************** */
27
- /* global Reflect, Promise */
28
- var extendStatics = function (d, b) {
29
- extendStatics = Object.setPrototypeOf ||
30
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
31
- function (d, b) { for (var p in b)
32
- if (Object.prototype.hasOwnProperty.call(b, p))
33
- d[p] = b[p]; };
34
- return extendStatics(d, b);
35
- };
36
- function __extends(d, b) {
37
- if (typeof b !== "function" && b !== null)
38
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
39
- extendStatics(d, b);
40
- function __() { this.constructor = d; }
41
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
42
- }
43
- var __assign = function () {
44
- __assign = Object.assign || function __assign(t) {
45
- for (var s, i = 1, n = arguments.length; i < n; i++) {
46
- s = arguments[i];
47
- for (var p in s)
48
- if (Object.prototype.hasOwnProperty.call(s, p))
49
- t[p] = s[p];
50
- }
51
- return t;
52
- };
53
- return __assign.apply(this, arguments);
54
- };
55
- function __rest(s, e) {
56
- var t = {};
57
- for (var p in s)
58
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
59
- t[p] = s[p];
60
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
61
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
62
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
63
- t[p[i]] = s[p[i]];
64
- }
65
- return t;
66
- }
67
- function __decorate(decorators, target, key, desc) {
68
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
69
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
70
- r = Reflect.decorate(decorators, target, key, desc);
71
- else
72
- for (var i = decorators.length - 1; i >= 0; i--)
73
- if (d = decorators[i])
74
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
75
- return c > 3 && r && Object.defineProperty(target, key, r), r;
76
- }
77
- function __param(paramIndex, decorator) {
78
- return function (target, key) { decorator(target, key, paramIndex); };
79
- }
80
- function __metadata(metadataKey, metadataValue) {
81
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
82
- return Reflect.metadata(metadataKey, metadataValue);
83
- }
84
- function __awaiter(thisArg, _arguments, P, generator) {
85
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
86
- return new (P || (P = Promise))(function (resolve, reject) {
87
- function fulfilled(value) { try {
88
- step(generator.next(value));
89
- }
90
- catch (e) {
91
- reject(e);
92
- } }
93
- function rejected(value) { try {
94
- step(generator["throw"](value));
95
- }
96
- catch (e) {
97
- reject(e);
98
- } }
99
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
100
- step((generator = generator.apply(thisArg, _arguments || [])).next());
101
- });
102
- }
103
- function __generator(thisArg, body) {
104
- var _ = { label: 0, sent: function () { if (t[0] & 1)
105
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
106
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
107
- function verb(n) { return function (v) { return step([n, v]); }; }
108
- function step(op) {
109
- if (f)
110
- throw new TypeError("Generator is already executing.");
111
- while (_)
112
- try {
113
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
114
- return t;
115
- if (y = 0, t)
116
- op = [op[0] & 2, t.value];
117
- switch (op[0]) {
118
- case 0:
119
- case 1:
120
- t = op;
121
- break;
122
- case 4:
123
- _.label++;
124
- return { value: op[1], done: false };
125
- case 5:
126
- _.label++;
127
- y = op[1];
128
- op = [0];
129
- continue;
130
- case 7:
131
- op = _.ops.pop();
132
- _.trys.pop();
133
- continue;
134
- default:
135
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
136
- _ = 0;
137
- continue;
138
- }
139
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
140
- _.label = op[1];
141
- break;
142
- }
143
- if (op[0] === 6 && _.label < t[1]) {
144
- _.label = t[1];
145
- t = op;
146
- break;
147
- }
148
- if (t && _.label < t[2]) {
149
- _.label = t[2];
150
- _.ops.push(op);
151
- break;
152
- }
153
- if (t[2])
154
- _.ops.pop();
155
- _.trys.pop();
156
- continue;
157
- }
158
- op = body.call(thisArg, _);
159
- }
160
- catch (e) {
161
- op = [6, e];
162
- y = 0;
163
- }
164
- finally {
165
- f = t = 0;
166
- }
167
- if (op[0] & 5)
168
- throw op[1];
169
- return { value: op[0] ? op[1] : void 0, done: true };
170
- }
171
- }
172
- var __createBinding = Object.create ? (function (o, m, k, k2) {
173
- if (k2 === undefined)
174
- k2 = k;
175
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
176
- }) : (function (o, m, k, k2) {
177
- if (k2 === undefined)
178
- k2 = k;
179
- o[k2] = m[k];
180
- });
181
- function __exportStar(m, o) {
182
- for (var p in m)
183
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
184
- __createBinding(o, m, p);
185
- }
186
- function __values(o) {
187
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
188
- if (m)
189
- return m.call(o);
190
- if (o && typeof o.length === "number")
191
- return {
192
- next: function () {
193
- if (o && i >= o.length)
194
- o = void 0;
195
- return { value: o && o[i++], done: !o };
196
- }
197
- };
198
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
199
- }
200
- function __read(o, n) {
201
- var m = typeof Symbol === "function" && o[Symbol.iterator];
202
- if (!m)
203
- return o;
204
- var i = m.call(o), r, ar = [], e;
205
- try {
206
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
207
- ar.push(r.value);
208
- }
209
- catch (error) {
210
- e = { error: error };
211
- }
212
- finally {
213
- try {
214
- if (r && !r.done && (m = i["return"]))
215
- m.call(i);
216
- }
217
- finally {
218
- if (e)
219
- throw e.error;
220
- }
221
- }
222
- return ar;
223
- }
224
- /** @deprecated */
225
- function __spread() {
226
- for (var ar = [], i = 0; i < arguments.length; i++)
227
- ar = ar.concat(__read(arguments[i]));
228
- return ar;
229
- }
230
- /** @deprecated */
231
- function __spreadArrays() {
232
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
233
- s += arguments[i].length;
234
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
235
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
236
- r[k] = a[j];
237
- return r;
238
- }
239
- function __spreadArray(to, from, pack) {
240
- if (pack || arguments.length === 2)
241
- for (var i = 0, l = from.length, ar; i < l; i++) {
242
- if (ar || !(i in from)) {
243
- if (!ar)
244
- ar = Array.prototype.slice.call(from, 0, i);
245
- ar[i] = from[i];
246
- }
247
- }
248
- return to.concat(ar || from);
249
- }
250
- function __await(v) {
251
- return this instanceof __await ? (this.v = v, this) : new __await(v);
252
- }
253
- function __asyncGenerator(thisArg, _arguments, generator) {
254
- if (!Symbol.asyncIterator)
255
- throw new TypeError("Symbol.asyncIterator is not defined.");
256
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
257
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
258
- function verb(n) { if (g[n])
259
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
260
- function resume(n, v) { try {
261
- step(g[n](v));
262
- }
263
- catch (e) {
264
- settle(q[0][3], e);
265
- } }
266
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
267
- function fulfill(value) { resume("next", value); }
268
- function reject(value) { resume("throw", value); }
269
- function settle(f, v) { if (f(v), q.shift(), q.length)
270
- resume(q[0][0], q[0][1]); }
271
- }
272
- function __asyncDelegator(o) {
273
- var i, p;
274
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
275
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
276
- }
277
- function __asyncValues(o) {
278
- if (!Symbol.asyncIterator)
279
- throw new TypeError("Symbol.asyncIterator is not defined.");
280
- var m = o[Symbol.asyncIterator], i;
281
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
282
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
283
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
284
- }
285
- function __makeTemplateObject(cooked, raw) {
286
- if (Object.defineProperty) {
287
- Object.defineProperty(cooked, "raw", { value: raw });
288
- }
289
- else {
290
- cooked.raw = raw;
291
- }
292
- return cooked;
293
- }
294
- ;
295
- var __setModuleDefault = Object.create ? (function (o, v) {
296
- Object.defineProperty(o, "default", { enumerable: true, value: v });
297
- }) : function (o, v) {
298
- o["default"] = v;
299
- };
300
- function __importStar(mod) {
301
- if (mod && mod.__esModule)
302
- return mod;
303
- var result = {};
304
- if (mod != null)
305
- for (var k in mod)
306
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
307
- __createBinding(result, mod, k);
308
- __setModuleDefault(result, mod);
309
- return result;
310
- }
311
- function __importDefault(mod) {
312
- return (mod && mod.__esModule) ? mod : { default: mod };
313
- }
314
- function __classPrivateFieldGet(receiver, state, kind, f) {
315
- if (kind === "a" && !f)
316
- throw new TypeError("Private accessor was defined without a getter");
317
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
318
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
319
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
320
- }
321
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
322
- if (kind === "m")
323
- throw new TypeError("Private method is not writable");
324
- if (kind === "a" && !f)
325
- throw new TypeError("Private accessor was defined without a setter");
326
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
327
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
328
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
329
- }
330
-
331
- /**
332
- * @description
333
- *
334
- * Allows to simulate the loading of ng modules in tests.
335
- *
336
- * ```
337
- * const loader = TestBed.inject(NgModuleFactoryLoader);
338
- *
339
- * @Component({template: 'lazy-loaded'})
340
- * class LazyLoadedComponent {}
341
- * @NgModule({
342
- * declarations: [LazyLoadedComponent],
343
- * imports: [RouterModule.forChild([{path: 'loaded', component: LazyLoadedComponent}])]
344
- * })
345
- *
346
- * class LoadedModule {}
347
- *
348
- * // sets up stubbedModules
349
- * loader.stubbedModules = {lazyModule: LoadedModule};
350
- *
351
- * router.resetConfig([
352
- * {path: 'lazy', loadChildren: 'lazyModule'},
353
- * ]);
354
- *
355
- * router.navigateByUrl('/lazy/loaded');
356
- * ```
357
- *
358
- * @publicApi
359
- */
360
- var SpyNgModuleFactoryLoader = /** @class */ (function () {
361
- function SpyNgModuleFactoryLoader(compiler) {
362
- this.compiler = compiler;
363
- /**
364
- * @docsNotRequired
365
- */
366
- this._stubbedModules = {};
367
- }
368
- Object.defineProperty(SpyNgModuleFactoryLoader.prototype, "stubbedModules", {
369
- /**
370
- * @docsNotRequired
371
- */
372
- get: function () {
373
- return this._stubbedModules;
374
- },
375
- /**
376
- * @docsNotRequired
377
- */
378
- set: function (modules) {
379
- var e_1, _a;
380
- var res = {};
381
- try {
382
- for (var _b = __values(Object.keys(modules)), _c = _b.next(); !_c.done; _c = _b.next()) {
383
- var t = _c.value;
384
- res[t] = this.compiler.compileModuleAsync(modules[t]);
385
- }
386
- }
387
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
388
- finally {
389
- try {
390
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
391
- }
392
- finally { if (e_1) throw e_1.error; }
393
- }
394
- this._stubbedModules = res;
395
- },
396
- enumerable: false,
397
- configurable: true
398
- });
399
- SpyNgModuleFactoryLoader.prototype.load = function (path) {
400
- if (this._stubbedModules[path]) {
401
- return this._stubbedModules[path];
402
- }
403
- else {
404
- return Promise.reject(new Error("Cannot find module " + path));
405
- }
406
- };
407
- return SpyNgModuleFactoryLoader;
408
- }());
409
- SpyNgModuleFactoryLoader.decorators = [
410
- { type: core.Injectable }
411
- ];
412
- SpyNgModuleFactoryLoader.ctorParameters = function () { return [
413
- { type: core.Compiler }
414
- ]; };
415
- function isUrlHandlingStrategy(opts) {
416
- // This property check is needed because UrlHandlingStrategy is an interface and doesn't exist at
417
- // runtime.
418
- return 'shouldProcessUrl' in opts;
419
- }
420
- /**
421
- * Router setup factory function used for testing.
422
- *
423
- * @publicApi
424
- */
425
- function setupTestingRouter(urlSerializer, contexts, location, loader, compiler, injector, routes, opts, urlHandlingStrategy, routeReuseStrategy) {
426
- var router$1 = new router.Router(null, urlSerializer, contexts, location, injector, loader, compiler, router.ɵflatten(routes));
427
- if (opts) {
428
- // Handle deprecated argument ordering.
429
- if (isUrlHandlingStrategy(opts)) {
430
- router$1.urlHandlingStrategy = opts;
431
- }
432
- else {
433
- // Handle ExtraOptions
434
- router.ɵassignExtraOptionsToRouter(opts, router$1);
435
- }
436
- }
437
- if (urlHandlingStrategy) {
438
- router$1.urlHandlingStrategy = urlHandlingStrategy;
439
- }
440
- if (routeReuseStrategy) {
441
- router$1.routeReuseStrategy = routeReuseStrategy;
442
- }
443
- return router$1;
444
- }
445
- /**
446
- * @description
447
- *
448
- * Sets up the router to be used for testing.
449
- *
450
- * The modules sets up the router to be used for testing.
451
- * It provides spy implementations of `Location`, `LocationStrategy`, and {@link
452
- * NgModuleFactoryLoader}.
453
- *
454
- * @usageNotes
455
- * ### Example
456
- *
457
- * ```
458
- * beforeEach(() => {
459
- * TestBed.configureTestingModule({
460
- * imports: [
461
- * RouterTestingModule.withRoutes(
462
- * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]
463
- * )
464
- * ]
465
- * });
466
- * });
467
- * ```
468
- *
469
- * @publicApi
470
- */
471
- var RouterTestingModule = /** @class */ (function () {
472
- function RouterTestingModule() {
473
- }
474
- RouterTestingModule.withRoutes = function (routes, config) {
475
- return {
476
- ngModule: RouterTestingModule,
477
- providers: [
478
- router.provideRoutes(routes),
479
- { provide: router.ROUTER_CONFIGURATION, useValue: config ? config : {} },
480
- ]
481
- };
482
- };
483
- return RouterTestingModule;
484
- }());
485
- RouterTestingModule.decorators = [
486
- { type: core.NgModule, args: [{
487
- exports: [router.RouterModule],
488
- providers: [
489
- router.ɵROUTER_PROVIDERS, { provide: common.Location, useClass: testing.SpyLocation },
490
- { provide: common.LocationStrategy, useClass: testing.MockLocationStrategy },
491
- { provide: core.NgModuleFactoryLoader, useClass: SpyNgModuleFactoryLoader }, {
492
- provide: router.Router,
493
- useFactory: setupTestingRouter,
494
- deps: [
495
- router.UrlSerializer, router.ChildrenOutletContexts, common.Location, core.NgModuleFactoryLoader, core.Compiler, core.Injector,
496
- router.ROUTES, router.ROUTER_CONFIGURATION, [router.UrlHandlingStrategy, new core.Optional()],
497
- [router.RouteReuseStrategy, new core.Optional()]
498
- ]
499
- },
500
- { provide: router.PreloadingStrategy, useExisting: router.NoPreloading }, router.provideRoutes([])
501
- ]
502
- },] }
503
- ];
504
-
505
- /**
506
- * @license
507
- * Copyright Google LLC All Rights Reserved.
508
- *
509
- * Use of this source code is governed by an MIT-style license that can be
510
- * found in the LICENSE file at https://angular.io/license
511
- */
512
-
513
- /**
514
- * @license
515
- * Copyright Google LLC All Rights Reserved.
516
- *
517
- * Use of this source code is governed by an MIT-style license that can be
518
- * found in the LICENSE file at https://angular.io/license
519
- */
520
- // This file only reexports content of the `src` folder. Keep it that way.
521
-
522
- /**
523
- * @license
524
- * Copyright Google LLC All Rights Reserved.
525
- *
526
- * Use of this source code is governed by an MIT-style license that can be
527
- * found in the LICENSE file at https://angular.io/license
528
- */
529
-
530
- /**
531
- * Generated bundle index. Do not edit.
532
- */
533
-
534
- exports.RouterTestingModule = RouterTestingModule;
535
- exports.SpyNgModuleFactoryLoader = SpyNgModuleFactoryLoader;
536
- exports.setupTestingRouter = setupTestingRouter;
537
-
538
- Object.defineProperty(exports, '__esModule', { value: true });
539
-
540
- })));
541
- //# sourceMappingURL=router-testing.umd.js.map