Skip to content

feat(cdk/testing): add option to customise TestElement#text #29324

Open
@bgotink

Description

@bgotink

Feature Description

We use web components in our angular components. We can override the browser's querySelectorAll in the testbed test environment to pierce through shadow roots. We would like to also be able to override the innerText/textContent functionality (for TestElement#text) of the browser as the builtin innerText and textContent properties skips over shadow content:

<angular-component>
  Hello,
  <web-component>
    <template shadowrootmode="open">World!</template>
  </web-component>
</angular-component>

--> document.querySelector('angular-component').innerText === 'Hello, '

image

Use Case

Improve unit testing using component harnesses when web components using shadow DOM are used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/testingfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions