tests.ScrollOffset
Where scroll moves a Scroll or a list to, in points along each axis.
Verwendung
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'));
});Typdeklaration
export interface ScrollOffset {
x?: number;
y?: number;
}Mitglieder 2
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
x | number | Nein | — |
y | number | Nein | — |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.