tests.ScrollOffset
Where scroll moves a Scroll or a list to, in points along each axis.
Utilisation
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'));
});Déclaration du type
export interface ScrollOffset {
x?: number;
y?: number;
}Membres 2
| Nom | Type | Requis | Description |
|---|---|---|---|
x | number | Non | — |
y | number | Non | — |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.