Skip to content
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

fix: unable to bind ngIf in angular 17+ #9314

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sabrina-10kc
Copy link

When component templates contain child templates, they are replaced with a mock template that contains a *ngIf this causes a failure when the component doesn't have NgIf imported.

Though this problem likely exists in some pre-angular 17 situations, it has been causing new failures to appear as people upgrade since 3rd party angular components are starting to use the new control flow syntax and no longer import CommonModule / NgIf.

Instead the mock template now uses @if syntax if angular is 17 or higher.

Fixes #8884

Use new angular control flow to avoid missing directive while mocking child templates

Solves help-me-mom#8884
Copy link

codecov bot commented Jun 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (cbbaec9) to head (34eeb82).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #9314   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          227       227           
  Lines         4935      4939    +4     
  Branches      1147      1148    +1     
=========================================
+ Hits          4935      4939    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sabrina-10kc
Copy link
Author

@satanTime Is there anything I need to change in this PR to help it get in & released ? (other than rebasing of course)

This issue is currently preventing use of errorOnUnknownElements for me

@satanTime
Copy link
Member

Hi @sabrina-10kc,

Thank you for your contribution.
Next week I'll be working on the rep and take a look at the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: MockRender throws an error on mat-tab
2 participants