@angular/router 17.0.0-next.5 → 17.0.0-next.6
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.
- package/esm2022/src/components/empty_outlet.mjs +3 -3
- package/esm2022/src/directives/router_link.mjs +6 -6
- package/esm2022/src/directives/router_link_active.mjs +6 -6
- package/esm2022/src/directives/router_outlet.mjs +6 -6
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/models.mjs +1 -1
- package/esm2022/src/navigation_transition.mjs +4 -4
- package/esm2022/src/page_title_strategy.mjs +7 -7
- package/esm2022/src/provide_router.mjs +10 -4
- package/esm2022/src/recognize.mjs +25 -19
- package/esm2022/src/route_reuse_strategy.mjs +6 -6
- package/esm2022/src/router.mjs +5 -5
- package/esm2022/src/router_config_loader.mjs +3 -3
- package/esm2022/src/router_module.mjs +6 -6
- package/esm2022/src/router_outlet_context.mjs +3 -3
- package/esm2022/src/router_preloader.mjs +10 -10
- package/esm2022/src/router_scroller.mjs +4 -4
- package/esm2022/src/state_manager.mjs +3 -3
- package/esm2022/src/url_handling_strategy.mjs +6 -6
- package/esm2022/src/url_tree.mjs +3 -3
- package/esm2022/src/utils/view_transition.mjs +6 -3
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/router_testing_harness.mjs +6 -6
- package/esm2022/testing/src/router_testing_module.mjs +7 -69
- package/fesm2022/router.mjs +117 -102
- package/fesm2022/router.mjs.map +1 -1
- package/fesm2022/testing.mjs +14 -69
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +1 -1
- package/index.d.ts +17 -3
- package/package.json +4 -4
- package/testing/index.d.ts +1 -19
- package/upgrade/index.d.ts +1 -1
package/fesm2022/testing.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.0-next.
|
|
2
|
+
* @license Angular v17.0.0-next.6
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Location } from '@angular/common';
|
|
8
7
|
import { provideLocationMocks } from '@angular/common/testing';
|
|
9
8
|
import * as i0 from '@angular/core';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { NgModule, Injectable, Component, ViewChild } from '@angular/core';
|
|
10
|
+
import { ROUTES, ROUTER_CONFIGURATION, RouterModule, ɵROUTER_PROVIDERS, withPreloading, NoPreloading, RouterOutlet, Router, ɵafterNextNavigation } from '@angular/router';
|
|
12
11
|
import { TestBed } from '@angular/core/testing';
|
|
13
12
|
|
|
14
13
|
function isUrlHandlingStrategy(opts) {
|
|
@@ -20,60 +19,6 @@ function throwInvalidConfigError(parameter) {
|
|
|
20
19
|
throw new Error(`Parameter ${parameter} does not match the one available in the injector. ` +
|
|
21
20
|
'`setupTestingRouter` is meant to be used as a factory function with dependencies coming from DI.');
|
|
22
21
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Router setup factory function used for testing.
|
|
25
|
-
*
|
|
26
|
-
* @publicApi
|
|
27
|
-
* @deprecated Use `provideRouter` or `RouterModule` instead.
|
|
28
|
-
*/
|
|
29
|
-
function setupTestingRouter(urlSerializer, contexts, location, compiler, injector, routes, opts, urlHandlingStrategy, routeReuseStrategy, titleStrategy) {
|
|
30
|
-
// Note: The checks below are to detect misconfigured providers and invalid uses of
|
|
31
|
-
// `setupTestingRouter`. This function is not used internally (neither in router code or anywhere
|
|
32
|
-
// in g3). It appears this function was exposed as publicApi by mistake and should not be used
|
|
33
|
-
// externally either. However, if it is, the documented intent is to be used as a factory function
|
|
34
|
-
// and parameter values should always match what's available in DI.
|
|
35
|
-
if (urlSerializer !== inject(UrlSerializer)) {
|
|
36
|
-
throwInvalidConfigError('urlSerializer');
|
|
37
|
-
}
|
|
38
|
-
if (contexts !== inject(ChildrenOutletContexts)) {
|
|
39
|
-
throwInvalidConfigError('contexts');
|
|
40
|
-
}
|
|
41
|
-
if (location !== inject(Location)) {
|
|
42
|
-
throwInvalidConfigError('location');
|
|
43
|
-
}
|
|
44
|
-
if (compiler !== inject(Compiler)) {
|
|
45
|
-
throwInvalidConfigError('compiler');
|
|
46
|
-
}
|
|
47
|
-
if (injector !== inject(Injector)) {
|
|
48
|
-
throwInvalidConfigError('injector');
|
|
49
|
-
}
|
|
50
|
-
if (routes !== inject(ROUTES)) {
|
|
51
|
-
throwInvalidConfigError('routes');
|
|
52
|
-
}
|
|
53
|
-
if (opts) {
|
|
54
|
-
// Handle deprecated argument ordering.
|
|
55
|
-
if (isUrlHandlingStrategy(opts)) {
|
|
56
|
-
if (opts !== inject(UrlHandlingStrategy)) {
|
|
57
|
-
throwInvalidConfigError('opts (UrlHandlingStrategy)');
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
if (opts !== inject(ROUTER_CONFIGURATION)) {
|
|
62
|
-
throwInvalidConfigError('opts (ROUTER_CONFIGURATION)');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (urlHandlingStrategy !== inject(UrlHandlingStrategy)) {
|
|
67
|
-
throwInvalidConfigError('urlHandlingStrategy');
|
|
68
|
-
}
|
|
69
|
-
if (routeReuseStrategy !== inject(RouteReuseStrategy)) {
|
|
70
|
-
throwInvalidConfigError('routeReuseStrategy');
|
|
71
|
-
}
|
|
72
|
-
if (titleStrategy !== inject(TitleStrategy)) {
|
|
73
|
-
throwInvalidConfigError('titleStrategy');
|
|
74
|
-
}
|
|
75
|
-
return new Router();
|
|
76
|
-
}
|
|
77
22
|
/**
|
|
78
23
|
* @description
|
|
79
24
|
*
|
|
@@ -109,16 +54,16 @@ class RouterTestingModule {
|
|
|
109
54
|
]
|
|
110
55
|
};
|
|
111
56
|
}
|
|
112
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.
|
|
113
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.
|
|
114
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.
|
|
57
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
58
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.6", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] }); }
|
|
59
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: RouterTestingModule, providers: [
|
|
115
60
|
ɵROUTER_PROVIDERS,
|
|
116
61
|
provideLocationMocks(),
|
|
117
62
|
withPreloading(NoPreloading).ɵproviders,
|
|
118
63
|
{ provide: ROUTES, multi: true, useValue: [] },
|
|
119
64
|
], imports: [RouterModule] }); }
|
|
120
65
|
}
|
|
121
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: RouterTestingModule, decorators: [{
|
|
122
67
|
type: NgModule,
|
|
123
68
|
args: [{
|
|
124
69
|
exports: [RouterModule],
|
|
@@ -147,18 +92,18 @@ class RootFixtureService {
|
|
|
147
92
|
this.fixture.detectChanges();
|
|
148
93
|
return this.fixture;
|
|
149
94
|
}
|
|
150
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.
|
|
151
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.
|
|
95
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
96
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: RootFixtureService, providedIn: 'root' }); }
|
|
152
97
|
}
|
|
153
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: RootFixtureService, decorators: [{
|
|
154
99
|
type: Injectable,
|
|
155
100
|
args: [{ providedIn: 'root' }]
|
|
156
101
|
}] });
|
|
157
102
|
class RootCmp {
|
|
158
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.
|
|
159
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.0-next.
|
|
103
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
104
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.0-next.6", type: RootCmp, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "outlet", first: true, predicate: RouterOutlet, descendants: true }], ngImport: i0, template: '<router-outlet></router-outlet>', isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
|
|
160
105
|
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: RootCmp, decorators: [{
|
|
162
107
|
type: Component,
|
|
163
108
|
args: [{
|
|
164
109
|
standalone: true,
|
|
@@ -260,5 +205,5 @@ class RouterTestingHarness {
|
|
|
260
205
|
* Generated bundle index. Do not edit.
|
|
261
206
|
*/
|
|
262
207
|
|
|
263
|
-
export { RouterTestingHarness, RouterTestingModule
|
|
208
|
+
export { RouterTestingHarness, RouterTestingModule };
|
|
264
209
|
//# sourceMappingURL=testing.mjs.map
|
package/fesm2022/testing.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","sources":["../../../../../../packages/router/testing/src/router_testing_module.ts","../../../../../../packages/router/testing/src/router_testing_harness.ts","../../../../../../packages/router/testing/src/testing.ts","../../../../../../packages/router/testing/public_api.ts","../../../../../../packages/router/testing/index.ts","../../../../../../packages/router/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Location} from '@angular/common';\nimport {provideLocationMocks} from '@angular/common/testing';\nimport {Compiler, inject, Injector, ModuleWithProviders, NgModule} from '@angular/core';\nimport {ChildrenOutletContexts, ExtraOptions, NoPreloading, Route, Router, ROUTER_CONFIGURATION, RouteReuseStrategy, RouterModule, ROUTES, Routes, TitleStrategy, UrlHandlingStrategy, UrlSerializer, withPreloading, ɵROUTER_PROVIDERS as ROUTER_PROVIDERS} from '@angular/router';\n\nfunction isUrlHandlingStrategy(opts: ExtraOptions|\n UrlHandlingStrategy): opts is UrlHandlingStrategy {\n // This property check is needed because UrlHandlingStrategy is an interface and doesn't exist at\n // runtime.\n return 'shouldProcessUrl' in opts;\n}\n\nfunction throwInvalidConfigError(parameter: string): never {\n throw new Error(\n `Parameter ${parameter} does not match the one available in the injector. ` +\n '`setupTestingRouter` is meant to be used as a factory function with dependencies coming from DI.');\n}\n\n/**\n * Router setup factory function used for testing.\n *\n * @publicApi\n * @deprecated Use `provideRouter` or `RouterModule` instead.\n */\nexport function setupTestingRouter(\n urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location,\n compiler: Compiler, injector: Injector, routes: Route[][],\n opts?: ExtraOptions|UrlHandlingStrategy|null, urlHandlingStrategy?: UrlHandlingStrategy,\n routeReuseStrategy?: RouteReuseStrategy, titleStrategy?: TitleStrategy) {\n // Note: The checks below are to detect misconfigured providers and invalid uses of\n // `setupTestingRouter`. This function is not used internally (neither in router code or anywhere\n // in g3). It appears this function was exposed as publicApi by mistake and should not be used\n // externally either. However, if it is, the documented intent is to be used as a factory function\n // and parameter values should always match what's available in DI.\n if (urlSerializer !== inject(UrlSerializer)) {\n throwInvalidConfigError('urlSerializer');\n }\n if (contexts !== inject(ChildrenOutletContexts)) {\n throwInvalidConfigError('contexts');\n }\n if (location !== inject(Location)) {\n throwInvalidConfigError('location');\n }\n if (compiler !== inject(Compiler)) {\n throwInvalidConfigError('compiler');\n }\n if (injector !== inject(Injector)) {\n throwInvalidConfigError('injector');\n }\n if (routes !== inject(ROUTES)) {\n throwInvalidConfigError('routes');\n }\n if (opts) {\n // Handle deprecated argument ordering.\n if (isUrlHandlingStrategy(opts)) {\n if (opts !== inject(UrlHandlingStrategy)) {\n throwInvalidConfigError('opts (UrlHandlingStrategy)');\n }\n } else {\n if (opts !== inject(ROUTER_CONFIGURATION)) {\n throwInvalidConfigError('opts (ROUTER_CONFIGURATION)');\n }\n }\n }\n\n if (urlHandlingStrategy !== inject(UrlHandlingStrategy)) {\n throwInvalidConfigError('urlHandlingStrategy');\n }\n\n if (routeReuseStrategy !== inject(RouteReuseStrategy)) {\n throwInvalidConfigError('routeReuseStrategy');\n }\n\n if (titleStrategy !== inject(TitleStrategy)) {\n throwInvalidConfigError('titleStrategy');\n }\n\n return new Router();\n}\n\n/**\n * @description\n *\n * Sets up the router to be used for testing.\n *\n * The modules sets up the router to be used for testing.\n * It provides spy implementations of `Location` and `LocationStrategy`.\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * beforeEach(() => {\n * TestBed.configureTestingModule({\n * imports: [\n * RouterModule.forRoot(\n * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]\n * )\n * ]\n * });\n * });\n * ```\n *\n * @publicApi\n */\n@NgModule({\n exports: [RouterModule],\n providers: [\n ROUTER_PROVIDERS,\n provideLocationMocks(),\n withPreloading(NoPreloading).ɵproviders,\n {provide: ROUTES, multi: true, useValue: []},\n ]\n})\nexport class RouterTestingModule {\n static withRoutes(routes: Routes, config?: ExtraOptions):\n ModuleWithProviders<RouterTestingModule> {\n return {\n ngModule: RouterTestingModule,\n providers: [\n {provide: ROUTES, multi: true, useValue: routes},\n {provide: ROUTER_CONFIGURATION, useValue: config ? config : {}},\n ]\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Component, DebugElement, Injectable, Type, ViewChild} from '@angular/core';\nimport {ComponentFixture, TestBed} from '@angular/core/testing';\nimport {Router, RouterOutlet, ɵafterNextNavigation as afterNextNavigation} from '@angular/router';\n\n@Injectable({providedIn: 'root'})\nexport class RootFixtureService {\n private fixture?: ComponentFixture<RootCmp>;\n private harness?: RouterTestingHarness;\n\n createHarness(): RouterTestingHarness {\n if (this.harness) {\n throw new Error('Only one harness should be created per test.');\n }\n this.harness = new RouterTestingHarness(this.getRootFixture());\n return this.harness;\n }\n\n private getRootFixture(): ComponentFixture<RootCmp> {\n if (this.fixture !== undefined) {\n return this.fixture;\n }\n this.fixture = TestBed.createComponent(RootCmp);\n this.fixture.detectChanges();\n return this.fixture;\n }\n}\n\n@Component({\n standalone: true,\n template: '<router-outlet></router-outlet>',\n imports: [RouterOutlet],\n})\nexport class RootCmp {\n @ViewChild(RouterOutlet) outlet?: RouterOutlet;\n}\n\n/**\n * A testing harness for the `Router` to reduce the boilerplate needed to test routes and routed\n * components.\n *\n * @publicApi\n */\nexport class RouterTestingHarness {\n /**\n * Creates a `RouterTestingHarness` instance.\n *\n * The `RouterTestingHarness` also creates its own root component with a `RouterOutlet` for the\n * purposes of rendering route components.\n *\n * Throws an error if an instance has already been created.\n * Use of this harness also requires `destroyAfterEach: true` in the `ModuleTeardownOptions`\n *\n * @param initialUrl The target of navigation to trigger before returning the harness.\n */\n static async create(initialUrl?: string): Promise<RouterTestingHarness> {\n const harness = TestBed.inject(RootFixtureService).createHarness();\n if (initialUrl !== undefined) {\n await harness.navigateByUrl(initialUrl);\n }\n return harness;\n }\n\n /**\n * Fixture of the root component of the RouterTestingHarness\n */\n public readonly fixture: ComponentFixture<unknown>;\n\n /** @internal */\n constructor(fixture: ComponentFixture<unknown>) {\n this.fixture = fixture;\n }\n\n /** Instructs the root fixture to run change detection. */\n detectChanges(): void {\n this.fixture.detectChanges();\n }\n /** The `DebugElement` of the `RouterOutlet` component. `null` if the outlet is not activated. */\n get routeDebugElement(): DebugElement|null {\n const outlet = (this.fixture.componentInstance as RootCmp).outlet;\n if (!outlet || !outlet.isActivated) {\n return null;\n }\n return this.fixture.debugElement.query(v => v.componentInstance === outlet.component);\n }\n /** The native element of the `RouterOutlet` component. `null` if the outlet is not activated. */\n get routeNativeElement(): HTMLElement|null {\n return this.routeDebugElement?.nativeElement ?? null;\n }\n\n /**\n * Triggers a `Router` navigation and waits for it to complete.\n *\n * The root component with a `RouterOutlet` created for the harness is used to render `Route`\n * components. The root component is reused within the same test in subsequent calls to\n * `navigateForTest`.\n *\n * When testing `Routes` with a guards that reject the navigation, the `RouterOutlet` might not be\n * activated and the `activatedComponent` may be `null`.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='Guard'}\n *\n * @param url The target of the navigation. Passed to `Router.navigateByUrl`.\n * @returns The activated component instance of the `RouterOutlet` after navigation completes\n * (`null` if the outlet does not get activated).\n */\n async navigateByUrl(url: string): Promise<null|{}>;\n /**\n * Triggers a router navigation and waits for it to complete.\n *\n * The root component with a `RouterOutlet` created for the harness is used to render `Route`\n * components.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='RoutedComponent'}\n *\n * The root component is reused within the same test in subsequent calls to `navigateByUrl`.\n *\n * This function also makes it easier to test components that depend on `ActivatedRoute` data.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='ActivatedRoute'}\n *\n * @param url The target of the navigation. Passed to `Router.navigateByUrl`.\n * @param requiredRoutedComponentType After navigation completes, the required type for the\n * activated component of the `RouterOutlet`. If the outlet is not activated or a different\n * component is activated, this function will throw an error.\n * @returns The activated component instance of the `RouterOutlet` after navigation completes.\n */\n async navigateByUrl<T>(url: string, requiredRoutedComponentType: Type<T>): Promise<T>;\n async navigateByUrl<T>(url: string, requiredRoutedComponentType?: Type<T>): Promise<T|null> {\n const router = TestBed.inject(Router);\n let resolveFn!: () => void;\n const redirectTrackingPromise = new Promise<void>(resolve => {\n resolveFn = resolve;\n });\n afterNextNavigation(TestBed.inject(Router), resolveFn);\n await router.navigateByUrl(url);\n await redirectTrackingPromise;\n this.fixture.detectChanges();\n const outlet = (this.fixture.componentInstance as RootCmp).outlet;\n // The outlet might not be activated if the user is testing a navigation for a guard that\n // rejects\n if (outlet && outlet.isActivated && outlet.activatedRoute.component) {\n const activatedComponent = outlet.component;\n if (requiredRoutedComponentType !== undefined &&\n !(activatedComponent instanceof requiredRoutedComponentType)) {\n throw new Error(`Unexpected routed component type. Expected ${\n requiredRoutedComponentType.name} but got ${activatedComponent.constructor.name}`);\n }\n return activatedComponent as T;\n } else {\n return null;\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router/testing package.\n */\nexport * from './router_testing_module';\nexport {RouterTestingHarness} from './router_testing_harness';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ROUTER_PROVIDERS","afterNextNavigation"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,qBAAqB,CAAC,IACmB,EAAA;;;IAGhD,OAAO,kBAAkB,IAAI,IAAI,CAAC;AACpC,CAAC;AAED,SAAS,uBAAuB,CAAC,SAAiB,EAAA;AAChD,IAAA,MAAM,IAAI,KAAK,CACX,CAAA,UAAA,EAAa,SAAS,CAAqD,mDAAA,CAAA;AAC3E,QAAA,kGAAkG,CAAC,CAAC;AAC1G,CAAC;AAED;;;;;AAKG;AACG,SAAU,kBAAkB,CAC9B,aAA4B,EAAE,QAAgC,EAAE,QAAkB,EAClF,QAAkB,EAAE,QAAkB,EAAE,MAAiB,EACzD,IAA4C,EAAE,mBAAyC,EACvF,kBAAuC,EAAE,aAA6B,EAAA;;;;;;AAMxE,IAAA,IAAI,aAAa,KAAK,MAAM,CAAC,aAAa,CAAC,EAAE;QAC3C,uBAAuB,CAAC,eAAe,CAAC,CAAC;AAC1C,KAAA;AACD,IAAA,IAAI,QAAQ,KAAK,MAAM,CAAC,sBAAsB,CAAC,EAAE;QAC/C,uBAAuB,CAAC,UAAU,CAAC,CAAC;AACrC,KAAA;AACD,IAAA,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,EAAE;QACjC,uBAAuB,CAAC,UAAU,CAAC,CAAC;AACrC,KAAA;AACD,IAAA,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,EAAE;QACjC,uBAAuB,CAAC,UAAU,CAAC,CAAC;AACrC,KAAA;AACD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SAAS;AACzC,gBAAA,EAAE,kBAAkB,YAAY,2BAA2B,CAAC,EAAE;AAChE,gBAAA,MAAM,IAAI,KAAK,CAAC,CAAA,2CAAA,EACZ,2BAA2B,CAAC,IAAI,CAAY,SAAA,EAAA,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAA,CAAE,CAAC,CAAC;AACxF,aAAA;AACD,YAAA,OAAO,kBAAuB,CAAC;AAChC,SAAA;AAAM,aAAA;AACL,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;KACF;AACF;;ACxJD;;;;AAIG;;ACJH;;;;AAIG;AAGH;;ACPA;;ACRA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../../../../../../packages/router/testing/src/router_testing_module.ts","../../../../../../packages/router/testing/src/router_testing_harness.ts","../../../../../../packages/router/testing/src/testing.ts","../../../../../../packages/router/testing/public_api.ts","../../../../../../packages/router/testing/index.ts","../../../../../../packages/router/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Location} from '@angular/common';\nimport {provideLocationMocks} from '@angular/common/testing';\nimport {Compiler, inject, Injector, ModuleWithProviders, NgModule} from '@angular/core';\nimport {ChildrenOutletContexts, ExtraOptions, NoPreloading, Route, Router, ROUTER_CONFIGURATION, RouteReuseStrategy, RouterModule, ROUTES, Routes, TitleStrategy, UrlHandlingStrategy, UrlSerializer, withPreloading, ɵROUTER_PROVIDERS as ROUTER_PROVIDERS} from '@angular/router';\n\nfunction isUrlHandlingStrategy(opts: ExtraOptions|\n UrlHandlingStrategy): opts is UrlHandlingStrategy {\n // This property check is needed because UrlHandlingStrategy is an interface and doesn't exist at\n // runtime.\n return 'shouldProcessUrl' in opts;\n}\n\nfunction throwInvalidConfigError(parameter: string): never {\n throw new Error(\n `Parameter ${parameter} does not match the one available in the injector. ` +\n '`setupTestingRouter` is meant to be used as a factory function with dependencies coming from DI.');\n}\n\n/**\n * @description\n *\n * Sets up the router to be used for testing.\n *\n * The modules sets up the router to be used for testing.\n * It provides spy implementations of `Location` and `LocationStrategy`.\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * beforeEach(() => {\n * TestBed.configureTestingModule({\n * imports: [\n * RouterModule.forRoot(\n * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]\n * )\n * ]\n * });\n * });\n * ```\n *\n * @publicApi\n */\n@NgModule({\n exports: [RouterModule],\n providers: [\n ROUTER_PROVIDERS,\n provideLocationMocks(),\n withPreloading(NoPreloading).ɵproviders,\n {provide: ROUTES, multi: true, useValue: []},\n ]\n})\nexport class RouterTestingModule {\n static withRoutes(routes: Routes, config?: ExtraOptions):\n ModuleWithProviders<RouterTestingModule> {\n return {\n ngModule: RouterTestingModule,\n providers: [\n {provide: ROUTES, multi: true, useValue: routes},\n {provide: ROUTER_CONFIGURATION, useValue: config ? config : {}},\n ]\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Component, DebugElement, Injectable, Type, ViewChild} from '@angular/core';\nimport {ComponentFixture, TestBed} from '@angular/core/testing';\nimport {Router, RouterOutlet, ɵafterNextNavigation as afterNextNavigation} from '@angular/router';\n\n@Injectable({providedIn: 'root'})\nexport class RootFixtureService {\n private fixture?: ComponentFixture<RootCmp>;\n private harness?: RouterTestingHarness;\n\n createHarness(): RouterTestingHarness {\n if (this.harness) {\n throw new Error('Only one harness should be created per test.');\n }\n this.harness = new RouterTestingHarness(this.getRootFixture());\n return this.harness;\n }\n\n private getRootFixture(): ComponentFixture<RootCmp> {\n if (this.fixture !== undefined) {\n return this.fixture;\n }\n this.fixture = TestBed.createComponent(RootCmp);\n this.fixture.detectChanges();\n return this.fixture;\n }\n}\n\n@Component({\n standalone: true,\n template: '<router-outlet></router-outlet>',\n imports: [RouterOutlet],\n})\nexport class RootCmp {\n @ViewChild(RouterOutlet) outlet?: RouterOutlet;\n}\n\n/**\n * A testing harness for the `Router` to reduce the boilerplate needed to test routes and routed\n * components.\n *\n * @publicApi\n */\nexport class RouterTestingHarness {\n /**\n * Creates a `RouterTestingHarness` instance.\n *\n * The `RouterTestingHarness` also creates its own root component with a `RouterOutlet` for the\n * purposes of rendering route components.\n *\n * Throws an error if an instance has already been created.\n * Use of this harness also requires `destroyAfterEach: true` in the `ModuleTeardownOptions`\n *\n * @param initialUrl The target of navigation to trigger before returning the harness.\n */\n static async create(initialUrl?: string): Promise<RouterTestingHarness> {\n const harness = TestBed.inject(RootFixtureService).createHarness();\n if (initialUrl !== undefined) {\n await harness.navigateByUrl(initialUrl);\n }\n return harness;\n }\n\n /**\n * Fixture of the root component of the RouterTestingHarness\n */\n public readonly fixture: ComponentFixture<unknown>;\n\n /** @internal */\n constructor(fixture: ComponentFixture<unknown>) {\n this.fixture = fixture;\n }\n\n /** Instructs the root fixture to run change detection. */\n detectChanges(): void {\n this.fixture.detectChanges();\n }\n /** The `DebugElement` of the `RouterOutlet` component. `null` if the outlet is not activated. */\n get routeDebugElement(): DebugElement|null {\n const outlet = (this.fixture.componentInstance as RootCmp).outlet;\n if (!outlet || !outlet.isActivated) {\n return null;\n }\n return this.fixture.debugElement.query(v => v.componentInstance === outlet.component);\n }\n /** The native element of the `RouterOutlet` component. `null` if the outlet is not activated. */\n get routeNativeElement(): HTMLElement|null {\n return this.routeDebugElement?.nativeElement ?? null;\n }\n\n /**\n * Triggers a `Router` navigation and waits for it to complete.\n *\n * The root component with a `RouterOutlet` created for the harness is used to render `Route`\n * components. The root component is reused within the same test in subsequent calls to\n * `navigateForTest`.\n *\n * When testing `Routes` with a guards that reject the navigation, the `RouterOutlet` might not be\n * activated and the `activatedComponent` may be `null`.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='Guard'}\n *\n * @param url The target of the navigation. Passed to `Router.navigateByUrl`.\n * @returns The activated component instance of the `RouterOutlet` after navigation completes\n * (`null` if the outlet does not get activated).\n */\n async navigateByUrl(url: string): Promise<null|{}>;\n /**\n * Triggers a router navigation and waits for it to complete.\n *\n * The root component with a `RouterOutlet` created for the harness is used to render `Route`\n * components.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='RoutedComponent'}\n *\n * The root component is reused within the same test in subsequent calls to `navigateByUrl`.\n *\n * This function also makes it easier to test components that depend on `ActivatedRoute` data.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='ActivatedRoute'}\n *\n * @param url The target of the navigation. Passed to `Router.navigateByUrl`.\n * @param requiredRoutedComponentType After navigation completes, the required type for the\n * activated component of the `RouterOutlet`. If the outlet is not activated or a different\n * component is activated, this function will throw an error.\n * @returns The activated component instance of the `RouterOutlet` after navigation completes.\n */\n async navigateByUrl<T>(url: string, requiredRoutedComponentType: Type<T>): Promise<T>;\n async navigateByUrl<T>(url: string, requiredRoutedComponentType?: Type<T>): Promise<T|null> {\n const router = TestBed.inject(Router);\n let resolveFn!: () => void;\n const redirectTrackingPromise = new Promise<void>(resolve => {\n resolveFn = resolve;\n });\n afterNextNavigation(TestBed.inject(Router), resolveFn);\n await router.navigateByUrl(url);\n await redirectTrackingPromise;\n this.fixture.detectChanges();\n const outlet = (this.fixture.componentInstance as RootCmp).outlet;\n // The outlet might not be activated if the user is testing a navigation for a guard that\n // rejects\n if (outlet && outlet.isActivated && outlet.activatedRoute.component) {\n const activatedComponent = outlet.component;\n if (requiredRoutedComponentType !== undefined &&\n !(activatedComponent instanceof requiredRoutedComponentType)) {\n throw new Error(`Unexpected routed component type. Expected ${\n requiredRoutedComponentType.name} but got ${activatedComponent.constructor.name}`);\n }\n return activatedComponent as T;\n } else {\n return null;\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router/testing package.\n */\nexport * from './router_testing_module';\nexport {RouterTestingHarness} from './router_testing_harness';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ROUTER_PROVIDERS","afterNextNavigation"],"mappings":";;;;;;;;;;;;AAaA,SAAS,qBAAqB,CAAC,IACmB,EAAA;;;IAGhD,OAAO,kBAAkB,IAAI,IAAI,CAAC;AACpC,CAAC;AAED,SAAS,uBAAuB,CAAC,SAAiB,EAAA;AAChD,IAAA,MAAM,IAAI,KAAK,CACX,CAAA,UAAA,EAAa,SAAS,CAAqD,mDAAA,CAAA;AAC3E,QAAA,kGAAkG,CAAC,CAAC;AAC1G,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MAUU,mBAAmB,CAAA;AAC9B,IAAA,OAAO,UAAU,CAAC,MAAc,EAAE,MAAqB,EAAA;QAErD,OAAO;AACL,YAAA,QAAQ,EAAE,mBAAmB;AAC7B,YAAA,SAAS,EAAE;gBACT,EAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAC;AAChD,gBAAA,EAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,EAAE,EAAC;AAChE,aAAA;SACF,CAAC;KACH;yHAVU,mBAAmB,EAAA,IAAA,EAAA,E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,WAAW,CAAC,IAAI,CAAA,CAAE,CAAC,CAAC;AACxF,aAAA;AACD,YAAA,OAAO,kBAAuB,CAAC;AAChC,SAAA;AAAM,aAAA;AACL,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;KACF;AACF;;ACxJD;;;;AAIG;;ACJH;;;;AAIG;AAGH;;ACPA;;ACRA;;AAEG;;;;"}
|
package/fesm2022/upgrade.mjs
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.0-next.
|
|
2
|
+
* @license Angular v17.0.0-next.6
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2522,7 +2522,6 @@ export declare interface Route {
|
|
|
2522
2522
|
* A URL to redirect to when the path matches.
|
|
2523
2523
|
*
|
|
2524
2524
|
* Absolute if the URL begins with a slash (/), otherwise relative to the path URL.
|
|
2525
|
-
* Note that no further redirects are evaluated after an absolute redirect.
|
|
2526
2525
|
*
|
|
2527
2526
|
* When not present, router does not redirect.
|
|
2528
2527
|
*/
|
|
@@ -4330,6 +4329,21 @@ export declare const VERSION: Version;
|
|
|
4330
4329
|
*/
|
|
4331
4330
|
export declare type ViewTransitionsFeature = RouterFeature<RouterFeatureKind.ViewTransitionsFeature>;
|
|
4332
4331
|
|
|
4332
|
+
/**
|
|
4333
|
+
* Options to configure the View Transitions integration in the Router.
|
|
4334
|
+
*
|
|
4335
|
+
* @experimental
|
|
4336
|
+
* @publicApi
|
|
4337
|
+
* @see withViewTransitions
|
|
4338
|
+
*/
|
|
4339
|
+
declare interface ViewTransitionsFeatureOptions {
|
|
4340
|
+
/**
|
|
4341
|
+
* Skips the very first call to `startViewTransition`. This can be useful for disabling the
|
|
4342
|
+
* animation during the application's initial loading phase.
|
|
4343
|
+
*/
|
|
4344
|
+
skipInitialTransition?: boolean;
|
|
4345
|
+
}
|
|
4346
|
+
|
|
4333
4347
|
/**
|
|
4334
4348
|
* Enables binding information from the `Router` state directly to the inputs of the component in
|
|
4335
4349
|
* `Route` configurations.
|
|
@@ -4602,7 +4616,7 @@ export declare function withRouterConfig(options: RouterConfigOptions): RouterCo
|
|
|
4602
4616
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
|
|
4603
4617
|
* @experimental
|
|
4604
4618
|
*/
|
|
4605
|
-
export declare function withViewTransitions(): ViewTransitionsFeature;
|
|
4619
|
+
export declare function withViewTransitions(options?: ViewTransitionsFeatureOptions): ViewTransitionsFeature;
|
|
4606
4620
|
|
|
4607
4621
|
/**
|
|
4608
4622
|
* Performs the given action once the router finishes its next/current navigation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/router",
|
|
3
|
-
"version": "17.0.0-next.
|
|
3
|
+
"version": "17.0.0-next.6",
|
|
4
4
|
"description": "Angular - the routing library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"tslib": "^2.3.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@angular/core": "17.0.0-next.
|
|
28
|
-
"@angular/common": "17.0.0-next.
|
|
29
|
-
"@angular/platform-browser": "17.0.0-next.
|
|
27
|
+
"@angular/core": "17.0.0-next.6",
|
|
28
|
+
"@angular/common": "17.0.0-next.6",
|
|
29
|
+
"@angular/platform-browser": "17.0.0-next.6",
|
|
30
30
|
"rxjs": "^6.5.3 || ^7.4.0"
|
|
31
31
|
},
|
|
32
32
|
"ng-update": {
|
package/testing/index.d.ts
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.0-next.
|
|
2
|
+
* @license Angular v17.0.0-next.6
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
import { ChildrenOutletContexts } from '@angular/router';
|
|
9
|
-
import { Compiler } from '@angular/core';
|
|
10
8
|
import { ComponentFixture } from '@angular/core/testing';
|
|
11
9
|
import { DebugElement } from '@angular/core';
|
|
12
10
|
import { ExtraOptions } from '@angular/router';
|
|
13
11
|
import * as i0 from '@angular/core';
|
|
14
12
|
import * as i1 from '@angular/router';
|
|
15
|
-
import { Injector } from '@angular/core';
|
|
16
|
-
import { Location as Location_2 } from '@angular/common';
|
|
17
13
|
import { ModuleWithProviders } from '@angular/core';
|
|
18
|
-
import { Route } from '@angular/router';
|
|
19
|
-
import { Router } from '@angular/router';
|
|
20
|
-
import { RouteReuseStrategy } from '@angular/router';
|
|
21
14
|
import { Routes } from '@angular/router';
|
|
22
|
-
import { TitleStrategy } from '@angular/router';
|
|
23
15
|
import { Type } from '@angular/core';
|
|
24
|
-
import { UrlHandlingStrategy } from '@angular/router';
|
|
25
|
-
import { UrlSerializer } from '@angular/router';
|
|
26
16
|
|
|
27
17
|
/**
|
|
28
18
|
* A testing harness for the `Router` to reduce the boilerplate needed to test routes and routed
|
|
@@ -125,12 +115,4 @@ export declare class RouterTestingModule {
|
|
|
125
115
|
static ɵinj: i0.ɵɵInjectorDeclaration<RouterTestingModule>;
|
|
126
116
|
}
|
|
127
117
|
|
|
128
|
-
/**
|
|
129
|
-
* Router setup factory function used for testing.
|
|
130
|
-
*
|
|
131
|
-
* @publicApi
|
|
132
|
-
* @deprecated Use `provideRouter` or `RouterModule` instead.
|
|
133
|
-
*/
|
|
134
|
-
export declare function setupTestingRouter(urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location_2, compiler: Compiler, injector: Injector, routes: Route[][], opts?: ExtraOptions | UrlHandlingStrategy | null, urlHandlingStrategy?: UrlHandlingStrategy, routeReuseStrategy?: RouteReuseStrategy, titleStrategy?: TitleStrategy): Router;
|
|
135
|
-
|
|
136
118
|
export { }
|
package/upgrade/index.d.ts
CHANGED