tests.ScrollOffset
Where scroll moves a Scroll or a list to, in points along each axis.
Usage
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'));
});Type declaration
export interface ScrollOffset {
x?: number;
y?: number;
}Members 2
| Name | Type | Required | Description |
|---|---|---|---|
x | number | No | — |
y | number | No | — |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.