-
-
Notifications
You must be signed in to change notification settings - Fork 85
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: ngMocks.findInstance does not find AsyncPipe in structural directive #2314
Comments
Hi @parloti, thanks for the report. I think, the issue comes because of <ng-container [ngFor]="... | async">
<div class="array">
item: {{ item }}
</div>
</ng-container>
<ng-container [ngIf]="... | async">
<div class="false>false</div>
</ng-container>
<div class="text">{{ text$ | async }}</div>
<ng-container [ngIf]="... | async">
<div class="true">true</div>
</ng-container> and therefore the search should be done on Anyway, I'll take a look what can be done. |
So, I added "hungry" behavior, if a found element has a "structural directive" on its parent, then the parent also will be scanned. It won't work with Could you test if it does what you expect? ng-mocks.zip |
Perfect! I can also change Thank you very much. |
thanks for feedback, I ran out of CI/CD minutes. Because of that, the fix will be released on the first weekend in May :) Meanwhile, I'll adapt the fix for all angular versions. |
fix(ngMocks.findInstance): finds pipes in attributes #2314
v13.5.0 has been released and contains a fix for the issue. Feel free to reopen the issue or to submit a new one if you meet any problems. |
Description of the bug
ngMocks.findInstance does not find AsyncPipe in structural directive like ngIf and ngFor, regardless of whether element is displayed or not.
A repo with an example of the bug
Link: stackblitz
Expected vs actual behavior
ngMocks.findInstance should find the pipe used in the structural directive.
The text was updated successfully, but these errors were encountered: