char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Aleksander Grygierui: Linting & Formatting scripts (#26819)92d1bb0c9

char/aliceai-t5-moe
1.1 KiB32 linesraw
1// Regression test: opening a chat-form picker must not scroll the
2// conversation to the top. Root cause: the list's scroll effect fired
3// scrollIntoView on the initial mount, before the popover was positioned,
4// so the browser scrolled every scrollable ancestor to reveal the row.
5
6import PickerListScrollHarness from './components/PickerListScrollHarness.svelte';
7import { tick } from 'svelte';
8import { describe, expect, it } from 'vitest';
9import { render } from 'vitest-browser-svelte';
10
11describe('ChatFormPickerList mount scroll', () => {
12	it('does not scroll documentElement when the picker mounts', async () => {
13		const screen = render(PickerListScrollHarness);
14
15		await tick();
16
17		document.documentElement.scrollTop = document.documentElement.scrollHeight;
18		await tick();
19		const before = document.documentElement.scrollTop;
20
21		expect(before).toBeGreaterThan(0);
22
23		screen.component.openPicker();
24		await tick();
25		await new Promise((r) => setTimeout(r, 100));
26		await tick();
27
28		const after = document.documentElement.scrollTop;
29
30		expect(after).toBe(before);
31	});
32});