angular/packages/core/test
Andrew Scott 53ca936366 feat(router): Add ability to create UrlTree from any ActivatedRouteSnapshot (#45877)
This exposes a new function from the router public API that allows
developers to create a `UrlTree` from _any_ `ActivatedRouteSnapshot`.
The current Router APIs only support creating a `UrlTree` from an
`ActivatedRoute` which is both active _and_ materially appears in the
`UrlTree` (it cannot be an empty path named outlet). This is because the
implementation of the current way of creating a `UrlTree` attempts to
look up the `UrlSegment` of the `ActivatedRoute` in the currently active
`UrlTree` of the router. When this doesn't work, the `UrlTree` creation
fails.

Note that this API does not replace the current one. That would actually be a
breaking change but should be done at some point in the future (v15). That is,
`router.navigate` should call this new function. At that point, we can
remove `_lastPathIndex`, `_urlSegment`, and `_correctedPathIndex` from
the `ActivatedRoute`, along with all of the logic associated with
determining what those should be. In addition, this would unblock a fix
for #26081 because the `applyRedirects` and `recognize` operations
could be combined into one.  Overall, this would simplify logic in the router
and reduce code size. It also exposes core routing capabilities as a helper function
which were previously private API, which is a necessary step towards #42953.

As a stress test for this new function, it _was_ swapped in as the
default for `UrlTree` creation in #45859 and tested internally. The
results indicate that this function behaves correctly.

resolves #42191 (Tested directly)
resolves #38276 (The test with a guard covers this case)
resolves #22763 (Tested directly)

PR Close #45877
2022-05-24 10:40:24 -07:00
..
acceptance fix(core): produce proper error message for unknown props on <ng-template>s (#46068) 2022-05-23 10:03:23 -07:00
animation fix(animations): apply default params when resolved value is null or undefined (#45339) 2022-03-17 14:02:37 -07:00
bundling feat(router): Add ability to create UrlTree from any ActivatedRouteSnapshot (#45877) 2022-05-24 10:40:24 -07:00
change_detection refactor(core): remove duplicated code in change_detection_util (#45599) 2022-04-12 22:26:09 +00:00
compiler build: enable useUnknownInCatchVariables (#44679) 2022-02-01 18:17:29 +00:00
debug feat(core): triggerEventHandler accept optional eventObj (#45279) 2022-03-09 13:51:54 -08:00
di refactor(core): rename INJECTOR_INITIALIZER -> ENVIRONMENT_INITIALIZER (#45845) 2022-05-02 15:02:06 -07:00
dom test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
i18n build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
linker fix(core): better error message when directive extends a component (#45658) 2022-04-18 09:24:23 -07:00
metadata build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
reflection refactor(core): remove unused logic from reflection capabilities (#45335) 2022-03-24 11:02:39 -07:00
render3 refactor(core): remove ManualOnPush change detection (#45943) 2022-05-10 09:37:07 -07:00
sanitization refactor(core): make the error messages tree shakable (#44359) 2022-01-18 17:38:10 -08:00
strict_types refactor(core): rename ...WithMeta types to ...Declaration and alias to unknown (#41119) 2021-03-22 08:57:18 -07:00
testability test(core): reset Testability getter after each test (#45947) 2022-05-10 16:02:53 -07:00
util refactor(core): remove duplicated code in change_detection_util (#45599) 2022-04-12 22:26:09 +00:00
zone test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
application_init_spec.ts test(core): refactor ApplicationInitStatus tests to avoid TestBed side-effects (#33222) 2021-02-22 08:41:49 -08:00
application_module_spec.ts test(core): fix a crosstalk issue with locale ids (#45626) 2022-04-18 09:28:42 -07:00
application_ref_integration_spec.ts refactor: delete the View Engine runtime (#43884) 2021-11-23 21:10:06 +00:00
application_ref_spec.ts refactor(compiler-cli): reorganize importProvidersFrom to avoid cycles (#45687) 2022-04-20 16:01:55 -07:00
BUILD.bazel build: switch devmode output to es2015 (#44505) 2022-01-05 23:20:20 +00:00
component_fixture_spec.ts feat(core): update reference and doc to change async to waitAsync. (#37583) 2020-08-03 12:54:13 -07:00
dev_mode_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
directive_lifecycle_integration_spec.ts build: bundle spec files for saucelabs legacy job (#44281) 2021-11-30 11:56:04 -05:00
error_handler_spec.ts refactor(core): move runtime error code logic (#44398) 2022-01-06 23:43:18 +00:00
event_emitter_spec.ts test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
fake_async_spec.ts test: clean up internal testing utilities (#42177) 2021-05-26 20:07:25 +00:00
forward_ref_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
runtime_error_spec.ts refactor(core): the RuntimeError class should support more compact syntax (#44783) 2022-02-01 00:15:56 +00:00
test_bed_spec.ts fix(core): handle AOT-compiled standalone components in TestBed correctly (#46052) 2022-05-23 09:25:08 -07:00
util_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00