babylon-testing-library
Version:
Simple utilities that encourage good testing practices for Babylon.js
16 lines • 907 B
JavaScript
import { TextBlock } from '@babylonjs/gui';
import { findAllMatchingDescendants } from './utils';
import { buildQueries } from '../query-helpers';
const getMultipleError = (_c, text) => `Found multiple elements with the text: ${text}`;
const getMissingError = (container, message) => {
return `Failed to find an element matching: ${message}. Container: ${container}`;
};
const queryAllByText = (container, text) => {
const matcher = (control) => {
return control instanceof TextBlock && control.text === text;
};
return findAllMatchingDescendants(container, matcher);
};
const { queryBy: queryByText, getAllBy: getAllByText, getBy: getByText, findAllBy: findAllByText, findBy: findByText, } = buildQueries(queryAllByText, getMultipleError, getMissingError);
export { queryAllByText, queryByText, getAllByText, getByText, findAllByText, findByText, };
//# sourceMappingURL=text.js.map