babylon-testing-library
Version:
Simple utilities that encourage good testing practices for Babylon.js
16 lines • 1.11 kB
JavaScript
import { InputText } from '@babylonjs/gui';
import { findAllMatchingDescendants } from './utils';
import { buildQueries } from '../query-helpers';
const getMultipleError = (_c, text) => `Found multiple elements with the placeholder text of: ${text}`;
const getMissingError = (container, message) => {
return `Unable to find an element with the placeholder text of: ${message}. Container: ${container}`;
};
const queryAllByPlaceholderText = (container, text) => {
const matcher = (control) => {
return control instanceof InputText && control.placeholderText === text;
};
return findAllMatchingDescendants(container, matcher);
};
const { queryBy: queryByPlaceholderText, getAllBy: getAllByPlaceholderText, getBy: getByPlaceholderText, findAllBy: findAllByPlaceholderText, findBy: findByPlaceholderText, } = buildQueries(queryAllByPlaceholderText, getMultipleError, getMissingError);
export { queryAllByPlaceholderText, queryByPlaceholderText, getAllByPlaceholderText, getByPlaceholderText, findAllByPlaceholderText, findByPlaceholderText, };
//# sourceMappingURL=placeholder-text.js.map