|
1 | 1 | import test from "node:test"; |
2 | 2 | import assert from "node:assert/strict"; |
3 | 3 | import { |
| 4 | + createDefaultWorkbenchState, |
4 | 5 | normalizeWorkbenchState, |
5 | 6 | } from "../apps/web/src/state/workbench-core.ts"; |
6 | 7 | import { |
@@ -28,6 +29,13 @@ test("empty workbench state does not auto-open the launch overlay", () => { |
28 | 29 | assert.deepEqual(normalized.overlay.target, { type: "wsl", distro: "Ubuntu" }); |
29 | 30 | }); |
30 | 31 |
|
| 32 | +test("default workbench state keeps the launch overlay hidden on startup", () => { |
| 33 | + const initial = createDefaultWorkbenchState(); |
| 34 | + |
| 35 | + assert.equal(initial.tabs.length, 0); |
| 36 | + assert.equal(initial.overlay.visible, false); |
| 37 | +}); |
| 38 | + |
31 | 39 | test("bootstrap with zero open workspaces keeps the launch overlay hidden", () => { |
32 | 40 | const next = buildWorkbenchStateFromBootstrap( |
33 | 41 | { |
@@ -69,6 +77,50 @@ test("bootstrap with zero open workspaces keeps the launch overlay hidden", () = |
69 | 77 | assert.equal(next.overlay.visible, false); |
70 | 78 | }); |
71 | 79 |
|
| 80 | +test("bootstrap with zero open workspaces preserves a user-opened launch overlay", () => { |
| 81 | + const next = buildWorkbenchStateFromBootstrap( |
| 82 | + { |
| 83 | + tabs: [], |
| 84 | + activeTabId: "", |
| 85 | + layout: { |
| 86 | + leftWidth: 320, |
| 87 | + rightWidth: 320, |
| 88 | + rightSplit: 64, |
| 89 | + showCodePanel: true, |
| 90 | + showTerminalPanel: true, |
| 91 | + }, |
| 92 | + overlay: { |
| 93 | + visible: true, |
| 94 | + mode: "remote", |
| 95 | + input: "ssh://demo", |
| 96 | + target: { type: "wsl", distro: "Ubuntu" }, |
| 97 | + }, |
| 98 | + }, |
| 99 | + { |
| 100 | + workspaces: [], |
| 101 | + ui_state: { |
| 102 | + open_workspace_ids: [], |
| 103 | + active_workspace_id: null, |
| 104 | + layout: { |
| 105 | + left_width: 320, |
| 106 | + right_width: 320, |
| 107 | + right_split: 64, |
| 108 | + show_code_panel: true, |
| 109 | + show_terminal_panel: true, |
| 110 | + }, |
| 111 | + }, |
| 112 | + }, |
| 113 | + "en", |
| 114 | + defaultAppSettings(), |
| 115 | + ); |
| 116 | + |
| 117 | + assert.equal(next.tabs.length, 0); |
| 118 | + assert.equal(next.overlay.visible, true); |
| 119 | + assert.equal(next.overlay.mode, "remote"); |
| 120 | + assert.equal(next.overlay.input, "ssh://demo"); |
| 121 | + assert.deepEqual(next.overlay.target, { type: "wsl", distro: "Ubuntu" }); |
| 122 | +}); |
| 123 | + |
72 | 124 | test("ui state with zero open workspaces keeps the launch overlay hidden", () => { |
73 | 125 | const next = applyWorkbenchUiState( |
74 | 126 | { |
@@ -107,3 +159,42 @@ test("ui state with zero open workspaces keeps the launch overlay hidden", () => |
107 | 159 | assert.equal(next.overlay.input, "ssh://demo"); |
108 | 160 | assert.deepEqual(next.overlay.target, { type: "wsl", distro: "Ubuntu" }); |
109 | 161 | }); |
| 162 | + |
| 163 | +test("ui state with zero open workspaces preserves a user-opened launch overlay", () => { |
| 164 | + const next = applyWorkbenchUiState( |
| 165 | + { |
| 166 | + tabs: [], |
| 167 | + activeTabId: "", |
| 168 | + layout: { |
| 169 | + leftWidth: 320, |
| 170 | + rightWidth: 320, |
| 171 | + rightSplit: 64, |
| 172 | + showCodePanel: true, |
| 173 | + showTerminalPanel: true, |
| 174 | + }, |
| 175 | + overlay: { |
| 176 | + visible: true, |
| 177 | + mode: "remote", |
| 178 | + input: "ssh://demo", |
| 179 | + target: { type: "wsl", distro: "Ubuntu" }, |
| 180 | + }, |
| 181 | + }, |
| 182 | + { |
| 183 | + open_workspace_ids: [], |
| 184 | + active_workspace_id: null, |
| 185 | + layout: { |
| 186 | + left_width: 320, |
| 187 | + right_width: 320, |
| 188 | + right_split: 64, |
| 189 | + show_code_panel: true, |
| 190 | + show_terminal_panel: true, |
| 191 | + }, |
| 192 | + }, |
| 193 | + ); |
| 194 | + |
| 195 | + assert.equal(next.tabs.length, 0); |
| 196 | + assert.equal(next.overlay.visible, true); |
| 197 | + assert.equal(next.overlay.mode, "remote"); |
| 198 | + assert.equal(next.overlay.input, "ssh://demo"); |
| 199 | + assert.deepEqual(next.overlay.target, { type: "wsl", distro: "Ubuntu" }); |
| 200 | +}); |
0 commit comments