tests.TextMatch
The text a query looks for: an exact string, or a pattern.
Verwendung
Find text with a string or pattern.
// Find text with a string or pattern.
import { Text } from 'kuito';
import { assert, render, screen, test, type TextMatch } from 'kuito/tests';
// A string matches the whole text; a RegExp tests it.
const itemsLeft: TextMatch = /^\d+ items? left$/;
test('the footer counts what is left', async () => {
await render(<Text>3 items left</Text>);
assert.ok(screen.getByText(itemsLeft));
assert.equal(screen.queryByText('3 items'), null);
});Typdeklaration
export type TextMatch = string | RegExp;Typ
string | RegExpGeneriert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.