@angular/router 15.2.0-next.2 → 15.2.0-next.4

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 (38) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +3 -3
  2. package/esm2020/src/create_url_tree_strategy.mjs +22 -11
  3. package/esm2020/src/directives/router_link.mjs +6 -6
  4. package/esm2020/src/directives/router_link_active.mjs +3 -3
  5. package/esm2020/src/directives/router_outlet.mjs +3 -3
  6. package/esm2020/src/models.mjs +1 -1
  7. package/esm2020/src/navigation_transition.mjs +3 -3
  8. package/esm2020/src/page_title_strategy.mjs +6 -6
  9. package/esm2020/src/private_export.mjs +2 -1
  10. package/esm2020/src/provide_router.mjs +4 -29
  11. package/esm2020/src/route_reuse_strategy.mjs +6 -6
  12. package/esm2020/src/router.mjs +11 -7
  13. package/esm2020/src/router_config_loader.mjs +3 -3
  14. package/esm2020/src/router_module.mjs +4 -4
  15. package/esm2020/src/router_outlet_context.mjs +3 -3
  16. package/esm2020/src/router_preloader.mjs +9 -9
  17. package/esm2020/src/router_scroller.mjs +3 -3
  18. package/esm2020/src/url_handling_strategy.mjs +6 -6
  19. package/esm2020/src/url_tree.mjs +4 -4
  20. package/esm2020/src/utils/navigations.mjs +42 -0
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/testing/src/router_testing_harness.mjs +121 -0
  23. package/esm2020/testing/src/router_testing_module.mjs +4 -4
  24. package/esm2020/testing/src/testing.mjs +2 -1
  25. package/fesm2015/router.mjs +129 -105
  26. package/fesm2015/router.mjs.map +1 -1
  27. package/fesm2015/testing.mjs +125 -8
  28. package/fesm2015/testing.mjs.map +1 -1
  29. package/fesm2015/upgrade.mjs +1 -1
  30. package/fesm2020/router.mjs +128 -105
  31. package/fesm2020/router.mjs.map +1 -1
  32. package/fesm2020/testing.mjs +119 -8
  33. package/fesm2020/testing.mjs.map +1 -1
  34. package/fesm2020/upgrade.mjs +1 -1
  35. package/index.d.ts +104 -132
  36. package/package.json +4 -4
  37. package/testing/index.d.ts +69 -1
  38. package/upgrade/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.2.0-next.2
2
+ * @license Angular v15.2.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7,6 +7,7 @@
7
7
 
8
8
  import { ChildrenOutletContexts } from '@angular/router';
9
9
  import { Compiler } from '@angular/core';
10
+ import { DebugElement } from '@angular/core';
10
11
  import { ExtraOptions } from '@angular/router';
11
12
  import * as i0 from '@angular/core';
12
13
  import * as i1 from '@angular/router';
@@ -18,9 +19,76 @@ import { Router } from '@angular/router';
18
19
  import { RouteReuseStrategy } from '@angular/router';
19
20
  import { Routes } from '@angular/router';
20
21
  import { TitleStrategy } from '@angular/router';
22
+ import { Type } from '@angular/core';
21
23
  import { UrlHandlingStrategy } from '@angular/router';
22
24
  import { UrlSerializer } from '@angular/router';
23
25
 
26
+ /**
27
+ * A testing harness for the `Router` to reduce the boilerplate needed to test routes and routed
28
+ * components.
29
+ *
30
+ * @publicApi
31
+ */
32
+ export declare class RouterTestingHarness {
33
+ private readonly fixture;
34
+ /**
35
+ * Creates a `RouterTestingHarness` instance.
36
+ *
37
+ * The `RouterTestingHarness` also creates its own root component with a `RouterOutlet` for the
38
+ * purposes of rendering route components.
39
+ *
40
+ * Throws an error if an instance has already been created.
41
+ * Use of this harness also requires `destroyAfterEach: true` in the `ModuleTeardownOptions`
42
+ *
43
+ * @param initialUrl The target of navigation to trigger before returning the harness.
44
+ */
45
+ static create(initialUrl?: string): Promise<RouterTestingHarness>;
46
+ /** Instructs the root fixture to run change detection. */
47
+ detectChanges(): void;
48
+ /** The `DebugElement` of the `RouterOutlet` component. `null` if the outlet is not activated. */
49
+ get routeDebugElement(): DebugElement | null;
50
+ /** The native element of the `RouterOutlet` component. `null` if the outlet is not activated. */
51
+ get routeNativeElement(): HTMLElement | null;
52
+ /**
53
+ * Triggers a `Router` navigation and waits for it to complete.
54
+ *
55
+ * The root component with a `RouterOutlet` created for the harness is used to render `Route`
56
+ * components. The root component is reused within the same test in subsequent calls to
57
+ * `navigateForTest`.
58
+ *
59
+ * When testing `Routes` with a guards that reject the navigation, the `RouterOutlet` might not be
60
+ * activated and the `activatedComponent` may be `null`.
61
+ *
62
+ * {@example router/testing/test/router_testing_harness_examples.spec.ts region='Guard'}
63
+ *
64
+ * @param url The target of the navigation. Passed to `Router.navigateByUrl`.
65
+ * @returns The activated component instance of the `RouterOutlet` after navigation completes
66
+ * (`null` if the outlet does not get activated).
67
+ */
68
+ navigateByUrl(url: string): Promise<null | {}>;
69
+ /**
70
+ * Triggers a router navigation and waits for it to complete.
71
+ *
72
+ * The root component with a `RouterOutlet` created for the harness is used to render `Route`
73
+ * components.
74
+ *
75
+ * {@example router/testing/test/router_testing_harness_examples.spec.ts region='RoutedComponent'}
76
+ *
77
+ * The root component is reused within the same test in subsequent calls to `navigateByUrl`.
78
+ *
79
+ * This function also makes it easier to test components that depend on `ActivatedRoute` data.
80
+ *
81
+ * {@example router/testing/test/router_testing_harness_examples.spec.ts region='ActivatedRoute'}
82
+ *
83
+ * @param url The target of the navigation. Passed to `Router.navigateByUrl`.
84
+ * @param requiredRoutedComponentType After navigation completes, the required type for the
85
+ * activated component of the `RouterOutlet`. If the outlet is not activated or a different
86
+ * component is activated, this function will throw an error.
87
+ * @returns The activated component instance of the `RouterOutlet` after navigation completes.
88
+ */
89
+ navigateByUrl<T>(url: string, requiredRoutedComponentType: Type<T>): Promise<T>;
90
+ }
91
+
24
92
  /**
25
93
  * @description
26
94
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.2.0-next.2
2
+ * @license Angular v15.2.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */