tests.PressOptions
Makes press hold past the long-press delay, to test onLongPress.
Utilização
Press a particular point in a control.
// Press a particular point in a control.
import { Pressable, Text, signal } from 'kuito';
import { assert, press, render, screen, test, type PressOptions } from 'kuito/tests';
function Message() {
const menu = signal(false);
return (
<Pressable onLongPress={() => (menu.value = true)}>
<Text>Hello there</Text>
<Text hidden={!menu.value}>Reply</Text>
</Pressable>
);
}
const hold: PressOptions = { long: true };
test('holding a message opens its menu', async () => {
await render(<Message />);
await press(screen.getByText('Hello there'), hold);
assert.ok(screen.getByText('Reply'));
});Declaração do tipo
export interface PressOptions {
/** Holds it past the long-press delay: `onLongPress` instead of `onPress`. */
long?: boolean;
}Membros 1
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
long | boolean | Não | Holds it past the long-press delay: onLongPress instead of onPress. |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.