From 3707283baf94be68e91373e9303b4c0e0bf54813 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Tue, 31 Mar 2026 09:21:05 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20merge=20test=20regressions=20?= =?UTF-8?q?=E2=80=94=20openSession=20connect=20POST=20and=20cycleViewMode?= =?UTF-8?q?=20mock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- muxplex/frontend/app.js | 12 +++++------- muxplex/frontend/tests/test_app.mjs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/muxplex/frontend/app.js b/muxplex/frontend/app.js index 60862bd..1b5f8ef 100644 --- a/muxplex/frontend/app.js +++ b/muxplex/frontend/app.js @@ -1254,13 +1254,11 @@ async function openSession(name, opts = {}) { // Always spawn ttyd for this session — ensures correct session after service restart or page restore var _sourceUrl = opts.sourceUrl || ''; try { - if (!opts.skipConnect) { - if (_sourceUrl) { - var remoteConnectUrl = _sourceUrl.replace(/\/+$/, '') + '/api/sessions/' + encodeURIComponent(name) + '/connect'; - await fetch(remoteConnectUrl, { method: 'POST', credentials: 'include' }); - } else { - await api('POST', '/api/sessions/' + encodeURIComponent(name) + '/connect'); - } + if (_sourceUrl) { + var remoteConnectUrl = _sourceUrl.replace(/\/+$/, '') + '/api/sessions/' + encodeURIComponent(name) + '/connect'; + await fetch(remoteConnectUrl, { method: 'POST', credentials: 'include' }); + } else { + await api('POST', '/api/sessions/' + encodeURIComponent(name) + '/connect'); } } catch (err) { showToast(err.message || 'Connection failed'); diff --git a/muxplex/frontend/tests/test_app.mjs b/muxplex/frontend/tests/test_app.mjs index c56ac4a..3544917 100644 --- a/muxplex/frontend/tests/test_app.mjs +++ b/muxplex/frontend/tests/test_app.mjs @@ -3317,7 +3317,7 @@ test('openSession always POSTs to connect even when skipConnect option is passed const origQS = globalThis.document.querySelector; const origSetTimeout = globalThis.setTimeout; globalThis.fetch = async (url, opts) => { fetchCalls.push({ url, opts }); return { ok: true }; }; - globalThis.document.getElementById = () => ({ textContent: '', style: {}, classList: { remove: () => {}, add: () => {} } }); + globalThis.document.getElementById = () => ({ textContent: '', style: { removeProperty: () => {} }, classList: { remove: () => {}, add: () => {} } }); globalThis.document.querySelector = () => null; globalThis.setTimeout = () => {}; globalThis.window._openTerminal = () => {};