UNPKG

react-autosuggestions

Version:

An accessible React component to take the pain out of creating auto-suggestion components

38 lines (31 loc) 997 B
import { buildQueries, queryHelpers } from "@testing-library/react"; const queryAllByDataType = (...args) => queryHelpers.queryAllByAttribute("data-type", ...args); const queryAllById = (...args) => queryHelpers.queryAllByAttribute("id", ...args); const getMultipleError = (c, val) => `Found multiple elements with the data-type attribute of ${val}`; const getMissingError = (c, val) => `Unable to find an element with the data-type attribute of ${val}`; const [ queryByDataType, getAllByDataType, getByDataType, findAllByDataType, findByDataType, ] = buildQueries(queryAllByDataType, getMultipleError, getMissingError); const [queryById, getAllById, getById, findAllById, findById] = buildQueries( queryAllById, getMultipleError, getMissingError ); export { queryByDataType, queryAllByDataType, getByDataType, getAllByDataType, findAllByDataType, findByDataType, queryById, getAllById, getById, findAllById, findById };