summaryrefslogtreecommitdiffhomepage
path: root/vitest-setup.ts
diff options
context:
space:
mode:
Diffstat (limited to 'vitest-setup.ts')
-rw-r--r--vitest-setup.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/vitest-setup.ts b/vitest-setup.ts
index 2c29eea..10a3160 100644
--- a/vitest-setup.ts
+++ b/vitest-setup.ts
@@ -1,2 +1,16 @@
import "@testing-library/jest-dom/vitest";
import "fake-indexeddb/auto";
+
+// jsdom implements neither Element.scrollTo nor ResizeObserver; the smart-scroll
+// controller uses both against the real transcript element when App mounts. Stub
+// the outermost edges so component tests can render without throwing.
+if (typeof Element !== "undefined" && typeof Element.prototype.scrollTo !== "function") {
+ Element.prototype.scrollTo = () => {};
+}
+if (typeof globalThis.ResizeObserver === "undefined") {
+ globalThis.ResizeObserver = class {
+ observe(): void {}
+ unobserve(): void {}
+ disconnect(): void {}
+ };
+}