diff --git a/src/praisonai-desktop/frontend/tests/buttons.test.mjs b/src/praisonai-desktop/frontend/tests/buttons.test.mjs index 13efd254d..9a93ff7ad 100644 --- a/src/praisonai-desktop/frontend/tests/buttons.test.mjs +++ b/src/praisonai-desktop/frontend/tests/buttons.test.mjs @@ -63,8 +63,11 @@ async function boot() { w.requestAnimationFrame = (cb) => setTimeout(cb, 0); w.navigator.clipboard = { writeText: async () => {} }; w.confirm = () => true; - w.prompt = () => 'Research'; - w.alert = () => {}; + // This webview has no JS dialog panel: prompt returns null and alert + // shows nothing. Modelling the real platform is the point -- a stub that + // returns 'x' hid that "Move to project" issued no request at all. + w.prompt = () => null; + w.alert = () => { throw new Error('no dialog panel here'); }; w.scrollTo = () => {}; Object.defineProperty(w.HTMLElement.prototype, 'scrollIntoView', { value() {} }); }, @@ -185,6 +188,24 @@ test('Engine log opens and shows lines', async () => { assert.match(doc.getElementById('panel').textContent, /turn start/); }); +test('right-click on a chat moves it to a project via the in-app prompt', async () => { + const { doc, window, calls } = await boot(); + await settle(); + const row = doc.querySelector('#chats .chat, #chats > div'); + assert.ok(row, 'no chat row rendered'); + // window.prompt returns null here, so if the handler used it this issues + // nothing. The in-app askText panel must appear instead. + row.dispatchEvent(new window.MouseEvent('contextmenu', { bubbles: true, cancelable: true })); + await settle(); + const inp = doc.querySelector('.confirm-back .txt'); + assert.ok(inp, 'no in-app text prompt shown (window.prompt returned null)'); + inp.value = 'Research'; + click([...doc.querySelectorAll('.confirm-back .ok')].pop()); + await settle(); + assert.ok(calls.some((c) => c.startsWith('POST /project/')), + 'moving to a project issued no request'); +}); + test('every shell button produces its own observable effect', async () => { const { doc, calls } = await boot(); await settle(); diff --git a/src/praisonai-desktop/ui/index.html b/src/praisonai-desktop/ui/index.html index 9e67f1c62..edcf1b9b1 100644 --- a/src/praisonai-desktop/ui/index.html +++ b/src/praisonai-desktop/ui/index.html @@ -20,6 +20,9 @@ .confirm-box p{margin:0 0 1rem;font-size:.88rem;line-height:1.5} .confirm-box .row{display:flex;gap:.5rem;justify-content:flex-end} .confirm-box .ok.danger{background:var(--bad)} +.confirm-box .txt{width:100%;box-sizing:border-box;margin:0 0 1rem;background:var(--ground); + color:var(--ink);border:1px solid var(--rule);border-radius:6px;padding:.4rem .55rem; + font:inherit;font-size:.88rem} .updbar .updx{font-size:.72rem;padding:.25rem .6rem} /* In normal flow above the composer. Fixed-position at bottom:18px put it directly on top of the text field -- and a composer that grows to ten @@ -952,6 +955,38 @@