@testing-library/react#buildQueries JavaScript Examples
The following examples show how to use
@testing-library/react#buildQueries.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: customQueries.js From lens-extension-cc with MIT License | 6 votes |
[
queryAllBySelector,
queryBySelector,
getAllBySelector,
getBySelector,
findAllBySelector,
findBySelector,
] = (function () {
const queryAll = (element, selector) => element.querySelectorAll(selector);
const getMultipleError = (c, selector) =>
`Found multiple elements with this selector: ${selector}`;
const getMissingError = (c, selector) =>
`Unable to find an element with this selector: ${selector}`;
return [
queryAll,
...buildQueries(queryAll, getMultipleError, getMissingError),
];
})()