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

Issues with ChildContent using attribute selector #445

Closed
GerkinDev opened this issue Apr 27, 2021 · 8 comments · Fixed by #467
Closed

Issues with ChildContent using attribute selector #445

GerkinDev opened this issue Apr 27, 2021 · 8 comments · Fixed by #467

Comments

@GerkinDev
Copy link

So, it's me again. I'm having problems to mock component using ContentChild selected by attribute. Here is the demo: https://stackblitz.com/edit/ng-mocks-examples-mp9pgs?file=app/app.spec.ts

Related to #68

Thank you so much for your work. And, do you have a patreon or something so that I can buy you a beer ? 🍻

@satanTime
Copy link
Member

Thanks for the report!

About beer, thanks, it would be nice. The next task is to configure patreon 🤣

@GerkinDev GerkinDev changed the title Issues with ChildContent using attribute selector` Issues with ChildContent using attribute selector Apr 28, 2021
@satanTime
Copy link
Member

satanTime commented Apr 30, 2021

Hi there,

Might I ask whether @ContentChild('[someAttribute]') works in real code?

When I was testing it, for me it works only when id is provided: @ContentChild('idOfElement') for elements like <div #idOfElement></div>, when I tried with tag names or attributes - the property is always undefined.

Another thing is that such mock components require CommonModule to be provided in TestBed, it has been fixed, but the legacy implementation still needs it.

Working on the fix to avoid failures in tests.

@GerkinDev
Copy link
Author

NVM, this explains a lot of things actually 😅

@satanTime satanTime reopened this May 1, 2021
@satanTime
Copy link
Member

Yeah, but please wait with closing it. I added a fix to avoid runtime failures in such cases.

satanTime added a commit that referenced this issue May 1, 2021
fix: skipping wrong query selectors #445
@satanTime
Copy link
Member

v11.11.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.

@satanTime
Copy link
Member

Hi @GerkinDev,

how is life? I hope everything is fine on your side.

It took a while, and finally I've finished the process of verification and can officially accept beer donations: https://github.com/sponsors/satanTime.

@GerkinDev
Copy link
Author

Hi @GerkinDev,

how is life? I hope everything is fine on your side.

It took a while, and finally I've finished the process of verification and can officially accept beer donations: https://github.com/sponsors/satanTime.

Hey there ! Finally ! So, it ain't that much, but I will for sure back you much more when the fundraising of my company is done :) for now, I'm quite low on money.

Take a beer, you deserve it ;)

@satanTime
Copy link
Member

Thanks for the beer! It is a lot, even 1/10 would be enough :)

Good luck with the business and stay in touch 🤜 🤛 .

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

Successfully merging a pull request may close this issue.

2 participants