summaryrefslogtreecommitdiff
path: root/frontend/src/test-setup.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/test-setup.ts')
-rw-r--r--frontend/src/test-setup.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/frontend/src/test-setup.ts b/frontend/src/test-setup.ts
index cdd6071..10f9568 100644
--- a/frontend/src/test-setup.ts
+++ b/frontend/src/test-setup.ts
@@ -1,4 +1,20 @@
+// layerchart reads window.matchMedia (settings context, dark-mode aware
+// styling) in jsdom where no backend exists. Narrow shim for media queries
+// used by chart settings only.
+if (typeof window !== 'undefined' && !window.matchMedia) {
+ window.matchMedia = (query: string) => ({
+ matches: false,
+ media: query,
+ onchange: null,
+ addEventListener: () => {},
+ removeEventListener: () => {},
+ addListener: () => {},
+ removeListener: () => {},
+ dispatchEvent: () => false
+ });
+}
+
// jsdom does not implement Range.getClientRects, which CodeMirror's
// measurement layer calls for drawing decorations (diagnostics markers).
// Without it the suite emits an unhandled