New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug (or Docs Bug?): Unable to test recursive standalone component due to NG0300 #50525
Comments
The import |
It was added by It does seem to fix the issue. I guess we don't need a forwardRef for this specific type of recursion? |
This commit fixes the migrations for recursive components. fixes angular#50525
While the |
This commit fixes the migrations for recursive components. fixes angular#50525
I've reproduced the issue in an app, it happens when the component is compiled with the JIT compiler + has circular
|
It's actually even simpler: if a component sets itself in the
|
Before this fix, a self import would define the component twice in the `directiveRegistry` which would then fire a `NG0300` when compiled with the JIT. fixes angular#50525
Before this fix, a self import would define the component twice in the `directiveRegistry` which would then fire a `NG0300` when compiled with the JIT. fixes angular#50525
Components are implied to be self-referencing, but if they explicitly set themselves in the `imports` array, they would throw an error because we weren't filtering them out. Fixes angular#50525.
This commit fixes the migrations for recursive components. fixes angular#50525
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. |
…ngular#50559) Components are implied to be self-referencing, but if they explicitly set themselves in the `imports` array, they would throw an error because we weren't filtering them out. Fixes angular#50525. PR Close angular#50559
…50554) This commit fixes the migrations for recursive components. fixes angular#50525 PR Close angular#50554
…ngular#50559) Components are implied to be self-referencing, but if they explicitly set themselves in the `imports` array, they would throw an error because we weren't filtering them out. Fixes angular#50525. PR Close angular#50559
…50554) This commit fixes the migrations for recursive components. fixes angular#50525 PR Close angular#50554
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
I have a relatively simple component that recursively nests on itself to build a node tree of div tags with various css classes and inner text based on a configuration object. When I convert this component to a standalone component, my tests fail with NG0300 but the new component works fine in the application. I'm assuming I am doing something wrong in configuring the testing module or that there is some bug in it but I'm unable to find documentation covering this case. The full component:
to convert to standalone I used the new migration and it added these commented out lines and imports.
My Tests:
Again in this case all the migration did was change
declarations
toimports
The above functions and test passes... however if I switch it to the standalone version of both files then the test fails (as far as I can tell it still works though, this is just a test problem).
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
It would be nice if https://angular.io/guide/testing-components-basics said something about standalone components. And/Or if https://angular.io/guide/standalone-components or https://angular.io/guide/standalone-migration covered testing at all.
The text was updated successfully, but these errors were encountered: