Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

test(desktop): answer matchMedia in the toolbar harness's window

Tioit-Wang511a7c9cc3df
diff --git a/apps/desktop/test/helpers/composer-toolbar.mjs b/apps/desktop/test/helpers/composer-toolbar.mjs
index 4a0a1e684..8eb93a904 100644
--- a/apps/desktop/test/helpers/composer-toolbar.mjs
+++ b/apps/desktop/test/helpers/composer-toolbar.mjs
@@ -68,8 +68,10 @@ export const TOOLBAR_PROPS = {
export async function composerToolbar(t, ssr) {
const hadWindow = "window" in globalThis;
const { window } = globalThis;
- // The toolbar reads the shortcut platform off the preload bridge.
- globalThis.window = { piDesktop: { platform: "darwin" } };
+ // The toolbar reads the shortcut platform off the preload bridge; the
+ // transcript renders in this same test read `matchMedia` for reduced
+ // motion, so the stand-in window answers it too.
+ globalThis.window = { piDesktop: { platform: "darwin" }, matchMedia: () => ({ matches: false }) };
t.after(() => {
if (hadWindow) globalThis.window = window;
else delete globalThis.window;