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

findInstances inconsistent behavior: should it select instances in first of selector or all ? #2105

Closed
GerkinDev opened this issue Mar 22, 2022 · 2 comments · Fixed by #2125

Comments

@GerkinDev
Copy link

Heya ! It's me again !

So, I've rendered a component in which I want to select several instances of directives by selector, and I stumbled on a little inconsistency.

Here is the repro: https://stackblitz.com/edit/github-ytvy85-gfwzxj?file=src/test.spec.ts

Seing this: https://github.com/ike18t/ng-mocks/blob/57471fc88f342099cf000d998a634138f457c718/libs/ng-mocks/src/lib/mock-helper/find-instance/mock-helper.find-instances.ts#L19

Instances are returned from the 1st selector match. I would have assumed that it would return instances in all matching CSS selectors (see the 2nd test).

I know you've specified from the docs:

A css selector helps to find the first matched element. It will be used to look up the desired declaration.

But I don't see the cons of selecting all instances in all matching selectors. Just needs to have selectors specific enough.

Cheers !

@satanTime
Copy link
Member

Hi there, agree with you.

@satanTime
Copy link
Member

v13.3.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.

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