-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
@ContentChild mocking fails with html attribute selection #68
Comments
Hi, I'll take a look during next days. Current implementation supports only ids, but I'll check if it's possible to extend it to support not only id but also any selectors. |
I've checked your case and if you run your code - you can't see anything. Neither "This is mockable" nor "This is not mockable". Because Another case, when you want to continue usage of |
Hi @mattwilson1024 and @joebell1329, have you solved the issue or you need any assistance? |
I'm closing the issue due to no feedback, feel free to reopen it if you meet any issues. |
Hi, I'm experiencing this issue as well. In my case, I want to use an optional Should I open a new issue with proper sample ? |
Hi @GerkinDev, yes, please create a new one with an example. Finally, this weekend I have my hands on the issues. |
When mocking a component that has
@ContentChild
projection, the generated mock will be invalid if the@ContentChild
uses an HTML attribute selector.e.g.
@ContentChild('[projectedContent]'...
with<div projectedContent>This is not mockable</div>
This does not appear to be an issue when using Angular template reference selection
e.g.
@ContentChild('projectedContent'...
with<div #projectedContent>This is mockable</div>
When running the tests, they fail with the error
TypeError: Cannot read property 'undefined' of undefined
I've created a repo to demonstrate the issue at https://github.com/joebell1329/contentProjectionDemo
When running the tests in the demo, the issue seems to be with the generated HTML in
ng://DynamicTestModule/MockOfNotMockableComponent.html
The error is thrown on the line
<div *ngIf="mockRender_[projectedContent]" data-key="[projectedContent]">
The text was updated successfully, but these errors were encountered: