Rendering mocked component ContentChildren broken after upgrade to ng9
See original GitHub issueI have a number of component tests in my project, that rely on mocking dependant components. Many of them also rely on rendering outlets in these mocked components.
Before upgrading to ng9, everything worked just fine. But now, the outlets aren’t rendered anymore. I’ve tried debugging, and I’ve found that in this line https://github.com/ike18t/ng-mocks/blob/master/lib/mock-component/mock-component.ts#L118 the viewContainer
is always undefined.
If I explicitly disable Ivy ("angularCompilerOptions": { "enableIvy": false }
in tsconfig.spec.ts), tests pass. The problem is, I can’t easily do this for all my libs.
Have you tried unit testing with Ivy enabled? I don’t see it being disabled in your tsconfig
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (14 by maintainers)
Top Results From Across the Web
Rendering mocked component ContentChildren broken after ...
Before upgrading to ng9, everything worked just fine. But now, the outlets aren't rendered anymore. I've tried debugging, and I've found that in ......
Read more >ContentChildren is not being populated - Stack Overflow
In the ngAfterContentInit() method, I would have expected content children to be populated. Am I missing something? [Update]. So it turns out that...
Read more >ContentChildren - Angular
Use to get the QueryList of elements or directives from the content DOM. Any time a child element is added, removed, or moved,...
Read more >mozilla-central: changeset 394048 ...
The view renders // after the following promise (a different ... SINGLE_DEVICE_INFO); clients = ["mock-client"]; result = await component.
Read more >Angular — Using ContentChildren and ... - Liu Ting Chun
Whenever it is triggered, we grab the latest @ContentChildren . After that, we update our parent component based on our children state.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found a way, finalising changes.
I was able to reproduce the issue, working on fix.