Repository navigation
Conversation
atscott
left a comment
There was a problem hiding this comment.
Hi @zelliott, thanks for the PR. As mentioned in the last comment on the bug, there are actually several options that don't make it from ExtraOptions to the router when using RouterTestingModule. I think we should address those as well.
It might be a good idea to create a function in router_module like assignExtraOptionsToRouterFields(router: Router, options: ExtraOptions) { ... } and share the code for the RouterModule implementation and the RouterTestingModule
angular/packages/router/src/router_module.ts
Lines 443 to 483 in db56cf1
enableTracing)
0d8595d to
320c44a
Compare
Done, PTAL. |
atscott
left a comment
There was a problem hiding this comment.
One small nit on the test organization but otherwise LGTM. presubmit. Starting global as well.
We might want to consider adding a breaking change note even though it's pretty unlikely/rare that this would break people. Something like
"BREAKING CHANGE: The RouterTestingModule now correctly assigns errorHandler, urlUpdateSstraategy, (...etc) from the ExtraOptions to the test module rather than just malformedUriErrorHandler and paramsInheritanceStrategy. If your test is setting these options, they will now be applied to navigations where they were ignored before and could result in a change in test behavior."
…odule Previously, RouterTestingModule only assigned two of the options within ExtraOptions to the Router. Now, it assigns the same options as RouterModule does (with the exception of enableTracing) via a new shared function assignExtraOptionsToRouter. Fixes angular#23347
|
global presubmit shows no related failures (1 test failed, but it's already failing at head). Marking as merge ready. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Previously,
RouterTestingModuleonly assigned two of the options withinExtraOptionsto the router. Now, it assigns the same options asRouterModuledoes (with the exception ofenableTracingat the request of @atscott) via a new shared functionassignExtraOptionsToRouter.Fixes #23347
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Setting many of the options within
ExtraOptionsin the config forRouterTestingModuledid not actually update the router's config (e.g.onSameUrlNavigation).Issue Number: #23347
What is the new behavior?
The same options can now be properly set on both
RouterModuleandRouterTestingModule(with the exception ofenableTracing).Does this PR introduce a breaking change?
Other information