test-workspace-selection-ui.js 1.3 KB

12345678910111213141516
  1. #!/usr/bin/env node
  2. import assert from 'assert';
  3. import fs from 'fs';
  4. const html = fs.readFileSync('./public/index.html', 'utf8');
  5. assert(!html.includes('class="ws-tab-add"'), 'header should not render the standalone + workspace button');
  6. assert(html.includes("div.onclick = () => switchWorkspace(ws.path);"), 'workspace list should switch the current window');
  7. assert(html.includes("await switchWorkspace(picked.path);"), 'desktop folder picker should switch the current window');
  8. assert(html.includes("if (_browseCurrentDir) switchWorkspace(_browseCurrentDir);"), 'directory browser select should switch the current window');
  9. assert(html.includes('if (!currentWorkDir) {\n resetConversationState();'), 'empty-workspace init should clear old chat state');
  10. assert(html.includes("currentWorkDir = data.workDir || '';"), 'workspace_switched SSE should clear currentWorkDir when closing workspace');
  11. assert(html.includes("if (!currentWorkDir) {\n tree.innerHTML = '<div style=\"color:var(--text2);font-size:11px;padding:20px 10px;text-align:center;\">Select a project workspace from the top-left</div>';"), 'file tree should keep the empty-workspace placeholder');
  12. console.log('\n── Workspace Selection UI Regression ──');
  13. console.log('PASS test-workspace-selection-ui.js');