You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bindToComponentInputs does not work when using RouterTestingModule #54461
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
it looks like the code in RouterTestingModule does not take into account bindToComponentInputs so having Input for resolvables results in failing unit tests even if you define the correct resolves in the route definition.
RouterTestingModule does set up a specific configuration of the router. It's not strictly necessary - you can also use provideRouter() directly in your tests with whatever configuration you'd like.
But the fact still remains that RouterTestingModule has a second argument with router config which does include bindToComponentInputs, so I'd thought it should support such behaviour
As @alxhub mentioned, you can and should be using RouterModule or provideRouter directly in tests. RouterTestingModule is no longer needed or maintained so I've created a PR to officially deprecate it. The documentation was already updated to remove mentions of RouterTestingModule and the missing piece was the deprecation.
Activity
alxhub commentedon Feb 15, 2024
RouterTestingModuledoes set up a specific configuration of the router. It's not strictly necessary - you can also useprovideRouter()directly in your tests with whatever configuration you'd like.wawyed commentedon Feb 15, 2024
But the fact still remains that RouterTestingModule has a second argument with router config which does include bindToComponentInputs, so I'd thought it should support such behaviour
atscott commentedon Feb 15, 2024
As @alxhub mentioned, you can and should be using
RouterModuleorprovideRouterdirectly in tests.RouterTestingModuleis no longer needed or maintained so I've created a PR to officially deprecate it. The documentation was already updated to remove mentions ofRouterTestingModuleand the missing piece was the deprecation.wawyed commentedon Feb 15, 2024
I was not aware of that. I'll move to the new approach in that case.
Thanks!
docs(router): deprecate RouterTestingModule (angular#54466)
angular-automatic-lock-bot commentedon Mar 22, 2024
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.