tests.ScrollOffset
Where scroll moves a Scroll or a list to, in points along each axis.
Utilização
Set a test scroll position.
// Set a test scroll position.
import { Scroll, Text, signal } from 'kuito';
import { assert, render, scroll, screen, test, type ScrollOffset } from 'kuito/tests';
function Terms() {
const read = signal(false);
return (
<Scroll onReachEnd={() => (read.value = true)}>
<Text height={3000}>Terms of service…</Text>
<Text>{read.value ? 'Thanks for reading' : 'Keep scrolling'}</Text>
</Scroll>
);
}
const bottom: ScrollOffset = { y: 3000 };
test('reaching the end of the terms thanks the reader', async () => {
await render(<Terms />);
await scroll(screen.getByText('Terms of service…'), bottom);
assert.ok(screen.getByText('Thanks for reading'));
});Declaração do tipo
export interface ScrollOffset {
x?: number;
y?: number;
}Membros 2
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
x | number | Não | — |
y | number | Não | — |
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.