testing-library-docs icon indicating copy to clipboard operation
testing-library-docs copied to clipboard

doc(queryconfig): Allows configuring a different element query mechanism

Open MatthiasKainer opened this issue 4 years ago • 0 comments

Provides the ability to specify a different element query mechanism other than querySelector and querySelectorAll.

An example of the usage with Georgegriff/query-selector-shadow-dom looks like this:

import { querySelectorAllDeep, querySelectorDeep } from 'query-selector-shadow-dom';
configure({
    queryElement: querySelectorDeep,
    queryAllElements: querySelectorAllDeep,
})

After this line, a query will also drill into the shadow dom of elements on the page

Why:

In our project, we are using a design system build with web components (via stenciljs), and different projects in different frameworks (lit, react, vue) want to use this library. The corresponding pr can be found here: https://github.com/testing-library/dom-testing-library/pull/1054

MatthiasKainer avatar Nov 16 '21 15:11 MatthiasKainer