testing-library / testing-library/angular-testing-library

How to test components with ViewEncapsulation.ShadowDom?

Open
#290 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
792
Forks
95
Avg merge
1d 15h
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Angular component test with ViewEncapsulation.ShadowDom enabled for an Angular Element, then inspect how Angular Testing Library queries the rendered component. Done means establishing whether elements inside the shadow DOM can be found and documenting or implementing the required behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.