1 | /**
|
---|
2 | * @license Angular v12.2.9
|
---|
3 | * (c) 2010-2021 Google LLC. https://angular.io/
|
---|
4 | * License: MIT
|
---|
5 | */
|
---|
6 |
|
---|
7 | import { ChildrenOutletContexts } from '@angular/router';
|
---|
8 | import { Compiler } from '@angular/core';
|
---|
9 | import { ExtraOptions } from '@angular/router';
|
---|
10 | import { Injector } from '@angular/core';
|
---|
11 | import { Location as Location_2 } from '@angular/common';
|
---|
12 | import { ModuleWithProviders } from '@angular/core';
|
---|
13 | import { NgModuleFactory } from '@angular/core';
|
---|
14 | import { NgModuleFactoryLoader } from '@angular/core';
|
---|
15 | import { Route } from '@angular/router';
|
---|
16 | import { Router } from '@angular/router';
|
---|
17 | import { Routes } from '@angular/router';
|
---|
18 | import { UrlHandlingStrategy } from '@angular/router';
|
---|
19 | import { UrlSerializer } from '@angular/router';
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * @description
|
---|
23 | *
|
---|
24 | * Sets up the router to be used for testing.
|
---|
25 | *
|
---|
26 | * The modules sets up the router to be used for testing.
|
---|
27 | * It provides spy implementations of `Location`, `LocationStrategy`, and {@link
|
---|
28 | * NgModuleFactoryLoader}.
|
---|
29 | *
|
---|
30 | * @usageNotes
|
---|
31 | * ### Example
|
---|
32 | *
|
---|
33 | * ```
|
---|
34 | * beforeEach(() => {
|
---|
35 | * TestBed.configureTestingModule({
|
---|
36 | * imports: [
|
---|
37 | * RouterTestingModule.withRoutes(
|
---|
38 | * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]
|
---|
39 | * )
|
---|
40 | * ]
|
---|
41 | * });
|
---|
42 | * });
|
---|
43 | * ```
|
---|
44 | *
|
---|
45 | * @publicApi
|
---|
46 | */
|
---|
47 | export declare class RouterTestingModule {
|
---|
48 | static withRoutes(routes: Routes, config?: ExtraOptions): ModuleWithProviders<RouterTestingModule>;
|
---|
49 | }
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Router setup factory function used for testing.
|
---|
53 | *
|
---|
54 | * @publicApi
|
---|
55 | */
|
---|
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 | }
|
---|
117 |
|
---|
118 | export { }
|
---|