UNPKG

slate-test-utils

Version:

> 📣 Love Slate and looking for your next gig? Sirona Medical is [hiring](https://sironamedical.com/about-us/careers/)!

14 lines (13 loc) • 1.75 kB
import { queryHelpers, buildQueries, } from '@testing-library/react'; // The queryAllByAttribute is a shortcut for attribute-based matchers // You can also use document.querySelector or a combination of existing // testing library utilities to find matching nodes for your query const queryAllByDataEditorLeaf = (...args) => queryHelpers.queryAllByAttribute('data-editor-leaf', ...args); const getMultipleErrorLeaf = (c, dataValue) => `Found multiple elements with the data-editor-leaf attribute of: ${dataValue}`; const getMissingErrorLeaf = (c, dataValue) => `Unable to find an element with the data-editor-leaf attribute of: ${dataValue}`; const [queryByDataEditorLeaf, getAllByDataEditorLeaf, getByDataEditorLeaf, findAllByDataEditorLeaf, findByDataEditorLeaf,] = buildQueries(queryAllByDataEditorLeaf, getMultipleErrorLeaf, getMissingErrorLeaf); const queryAllByDataEditorElement = (...args) => queryHelpers.queryAllByAttribute('data-editor-element', ...args); const getMultipleErrorElement = (c, dataValue) => `Found multiple elements with the data-editor-element attribute of: ${dataValue}`; const getMissingErrorElement = (c, dataValue) => `Unable to find an element with the data-editor-element attribute of: ${dataValue}`; const [queryByDataEditorElement, getAllByDataEditorElement, getByDataEditorElement, findAllByDataEditorElement, findByDataEditorElement,] = buildQueries(queryAllByDataEditorElement, getMultipleErrorElement, getMissingErrorElement); export { queryByDataEditorLeaf, queryAllByDataEditorLeaf, getByDataEditorLeaf, getAllByDataEditorLeaf, findAllByDataEditorLeaf, findByDataEditorLeaf, queryByDataEditorElement, getAllByDataEditorElement, getByDataEditorElement, findAllByDataEditorElement, findByDataEditorElement, };