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

How to test components with ViewEncapsulation.ShadowDom? #290

Open
2YY opened this issue Mar 30, 2022 · 3 comments
Open

How to test components with ViewEncapsulation.ShadowDom? #290

2YY opened this issue Mar 30, 2022 · 3 comments

Comments

@2YY
Copy link

2YY commented Mar 30, 2022

Hi, I'm testing component that used as WebComponent (Angular Element).

And I want to enable shadow DOM encapsulation.

@Component({
  // ...
  encapsulation: ViewEncapsulation.ShadowDom // <- This!
})

But if shadow DOM encapsulation is enabled, Angular Testing Library seems failed find elements in shadow DOM.

Is there anything I can solve this problem?

Thanks.

@timdeschryver
Copy link
Member

Hi, thanks for raising this issue.
Unfortunately, we don't support shadow DOM for now.
We're tracking this in DOM Testing Library, if it lands there, it should also be possible to use it with Angular Testing Library.

@ralfting
Copy link

Hey @2YY, I had the same problem and I solved using this library (shadow-dom-testing-library), it works just fine for me.
I hope soon we are getting support from Angular Testing Library to get elements in a Shadow DOM.

@jtrentes
Copy link

jtrentes commented Mar 7, 2024

Is there any news on this topic? The tracked issue in DOM testing library has not been updated since 2022.

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

No branches or pull requests

4 participants