fix/refactor(common): prevent duplicate URL change notifications from SpyLocation and use TestBed.inject in the Location test suite#37459
Conversation
68e51d2 to
c8f6895
Compare
|
Hey @atscott, I've tried different things to get around this, but several other tests are broken by switching from This will break a lot of userland tests as well as What do we do? TypeScript suggests to use |
|
Hi @LayZeeDK Hmmm, I see. Thanks for investigating this. After taking a closer look, I think maybe Sorry for all this back and forth! I think |
Use the strongly typed TestBed.inject rather than the weakly typed inject test utility function. Reuse injected dependency variables between sibling test cases.
Prevent duplicate notifications from being emitted when multiple URL change listeners are registered using SpyLocation#onUrlChange. Use `@internal` annotation for the `_urlChangeSubscription` properties instead of the `private` access modifier. Otherwise, we get in trouble because of `SpyLocation implements Location`.
c8f6895 to
10af4db
Compare
Location and use TestBed.inject in its test suiteLocation + SpyLocation and use TestBed.inject in its test suite
Location + SpyLocation and use TestBed.inject in its test suiteSpyLocation and use TestBed.inject in the Location test suite
|
🏎️ Here we go, @atscott. Let's do this! |
atscott
left a comment
There was a problem hiding this comment.
Great, thanks so much for working on this!
Prevent duplicate notifications from being emitted when multiple URL change listeners are registered using Location#onUrlChange. PR Close #37404
Prevent duplicate notifications from being emitted when multiple URL change listeners are registered using SpyLocation#onUrlChange. Use `@internal` annotation for the `_urlChangeSubscription` properties instead of the `private` access modifier. Otherwise, we get in trouble because of `SpyLocation implements Location`. PR Close #37459
Use the strongly typed TestBed.inject rather than the weakly typed inject test utility function. Reuse injected dependency variables between sibling test cases. PR Close #37459
Prevent duplicate notifications from being emitted when multiple URL change listeners are registered using SpyLocation#onUrlChange. Use `@internal` annotation for the `_urlChangeSubscription` properties instead of the `private` access modifier. Otherwise, we get in trouble because of `SpyLocation implements Location`. PR Close #37459
Use the strongly typed TestBed.inject rather than the weakly typed inject test utility function. Reuse injected dependency variables between sibling test cases. PR Close angular#37459
Prevent duplicate notifications from being emitted when multiple URL change listeners are registered using SpyLocation#onUrlChange. Use `@internal` annotation for the `_urlChangeSubscription` properties instead of the `private` access modifier. Otherwise, we get in trouble because of `SpyLocation implements Location`. PR Close angular#37459
|
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. |
Use the strongly typed TestBed.inject rather than the weakly typed inject test utility function. Reuse injected dependency variables between sibling test cases. PR Close angular#37459
Prevent duplicate notifications from being emitted when multiple URL change listeners are registered using SpyLocation#onUrlChange. Use `@internal` annotation for the `_urlChangeSubscription` properties instead of the `private` access modifier. Otherwise, we get in trouble because of `SpyLocation implements Location`. PR Close angular#37459
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?
SpyLocationemits duplicate notifications to URL change listeners when multiple are registered.Locationuses theprivateacces modifier for the private_urlChangeSubscriptionmember.location_spec.tsuses the weakly typedinjectto resolve dependencies.Issue Number: As discussed in #37404
What is the new behavior?
SpyLocationonly emits one URL change notification to all listeners.Locationuse@internalJSDoc annotations for all private members.location_spec.tsuses the strongly typedTestBed.injectto resolve dependencies.Does this PR introduce a breaking change?
Other information
Cc @atscott