tests.RoleOptions
Narrows a role query to the view with this accessible name.
Verwendung
Find a control by role and accessible name.
// Find a control by role and accessible name.
import { Button, HStack } from 'kuito';
import { assert, press, render, screen, test, type RoleOptions } from 'kuito/tests';
const Player = (props: { onNext: () => void }) => (
<HStack>
<Button label="Previous track">⏮</Button>
<Button label="Next track" onPress={props.onNext}>
⏭
</Button>
</HStack>
);
// Two buttons: the accessible name tells them apart, as a screen reader does.
const next: RoleOptions = { name: 'Next track' };
test('the next button skips', async () => {
let skipped = false;
await render(<Player onNext={() => (skipped = true)} />);
await press(screen.getByRole('button', next));
assert.ok(skipped);
});Typdeklaration
export interface RoleOptions {
/** The accessible name: its `label`, or the text inside it. */
name?: TextMatch;
}Mitglieder 1
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
name | TextMatch | Nein | The accessible name: its label, or the text inside it. |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.