test: flush navigation scroll frames directly

This commit is contained in:
Peter Steinberger
2026-04-17 17:21:49 +01:00
parent 75e09e21f2
commit 1d26f0cc6e

View File

@@ -1,9 +1,13 @@
import { describe, expect, it } from "vitest";
import { afterEach, describe, expect, it, vi } from "vitest";
import "../test-helpers/load-styles.ts";
import { mountApp as mountTestApp, registerAppMountHooks } from "./test-helpers/app-mount.ts";
registerAppMountHooks();
afterEach(() => {
vi.restoreAllMocks();
});
function mountApp(pathname: string) {
return mountTestApp(pathname);
}
@@ -375,6 +379,10 @@ describe("control UI routing", () => {
});
it("auto-scrolls chat history to the latest message", async () => {
vi.spyOn(window, "requestAnimationFrame").mockImplementation((callback) => {
queueMicrotask(() => callback(performance.now()));
return 1;
});
const app = mountApp("/chat");
await app.updateComplete;