@weitc/dfy-awesome-sidebar 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +4540 -0
  2. package/FEASIBILITY.md +250 -0
  3. package/INSTALL.md +93 -0
  4. package/LICENSE +43 -0
  5. package/README.md +170 -2
  6. package/assets/backgrounds/sidebar-default.jpg +0 -0
  7. package/assets/eggs/325/avatar.png +0 -0
  8. package/assets/eggs/325/baka-65-105-40s.webm +0 -0
  9. package/assets/eggs/325/stage.jpg +0 -0
  10. package/assets/eggs/347/avatar.png +0 -0
  11. package/assets/eggs/347/stage.jpg +0 -0
  12. package/assets/eggs/347/track-10-50-40s.webm +0 -0
  13. package/assets/themes/glass/actions-frame.css +90 -0
  14. package/assets/themes/glass/brand-frame.css +64 -0
  15. package/assets/themes/glass/footer-frame.css +111 -0
  16. package/assets/themes/glass/header-frame.css +285 -0
  17. package/assets/themes/glass/options-frame.css +129 -0
  18. package/assets/themes/glass/sidebar-outer.css +66 -0
  19. package/assets/themes/glass/topbar-frame.css +91 -0
  20. package/assets/themes/metal/actions-frame.css +90 -0
  21. package/assets/themes/metal/brand-frame.css +64 -0
  22. package/assets/themes/metal/footer-frame.css +111 -0
  23. package/assets/themes/metal/header-frame.css +300 -0
  24. package/assets/themes/metal/options-frame.css +129 -0
  25. package/assets/themes/metal/sidebar-outer.css +66 -0
  26. package/assets/themes/metal/topbar-frame.css +91 -0
  27. package/assets/themes/minimal/actions-frame.css +90 -0
  28. package/assets/themes/minimal/brand-frame.css +64 -0
  29. package/assets/themes/minimal/footer-frame.css +115 -0
  30. package/assets/themes/minimal/header-frame.css +271 -0
  31. package/assets/themes/minimal/options-frame.css +129 -0
  32. package/assets/themes/minimal/sidebar-outer.css +66 -0
  33. package/assets/themes/minimal/topbar-frame.css +91 -0
  34. package/assets/themes/neon/actions-frame.css +90 -0
  35. package/assets/themes/neon/brand-frame.css +64 -0
  36. package/assets/themes/neon/footer-frame.css +111 -0
  37. package/assets/themes/neon/header-frame.css +286 -0
  38. package/assets/themes/neon/options-frame.css +129 -0
  39. package/assets/themes/neon/sidebar-outer.css +66 -0
  40. package/assets/themes/neon/topbar-frame.css +91 -0
  41. package/assets/themes/ocean/actions-frame.css +90 -0
  42. package/assets/themes/ocean/brand-frame.css +64 -0
  43. package/assets/themes/ocean/footer-frame.css +111 -0
  44. package/assets/themes/ocean/header-frame.css +287 -0
  45. package/assets/themes/ocean/options-frame.css +129 -0
  46. package/assets/themes/ocean/sidebar-outer.css +66 -0
  47. package/assets/themes/ocean/topbar-frame.css +91 -0
  48. package/assets/themes/oldday/actions-frame.css +90 -0
  49. package/assets/themes/oldday/brand-frame.css +43 -0
  50. package/assets/themes/oldday/footer-frame.css +116 -0
  51. package/assets/themes/oldday/header-frame.css +142 -0
  52. package/assets/themes/oldday/options-frame.css +129 -0
  53. package/assets/themes/oldday/sidebar-outer.css +69 -0
  54. package/assets/themes/oldday/topbar-frame.css +91 -0
  55. package/assets/themes/pop/actions-frame.css +3 -0
  56. package/assets/themes/pop/brand-frame.css +3 -0
  57. package/assets/themes/pop/footer-frame.css +3 -0
  58. package/assets/themes/pop/header-frame.css +289 -0
  59. package/assets/themes/pop/options-frame.css +3 -0
  60. package/assets/themes/pop/pop-dust.css +37 -0
  61. package/assets/themes/pop/sidebar-outer.css +3 -0
  62. package/assets/themes/pop/topbar-frame.css +3 -0
  63. package/assets/themes/vaporwave/actions-frame.css +3 -0
  64. package/assets/themes/vaporwave/brand-frame.css +3 -0
  65. package/assets/themes/vaporwave/footer-frame.css +3 -0
  66. package/assets/themes/vaporwave/header-frame.css +436 -0
  67. package/assets/themes/vaporwave/options-frame.css +3 -0
  68. package/assets/themes/vaporwave/sidebar-outer.css +3 -0
  69. package/assets/themes/vaporwave/topbar-frame.css +3 -0
  70. package/assets/themes/vaporwave/vapor-dust.css +40 -0
  71. package/client.js +8116 -0
  72. package/cordis.patch.yml +6 -0
  73. package/docs/ACCEPTANCE-/345/244/264/345/203/217/351/242/204/350/247/210-20261201.md +42 -0
  74. package/docs/DETAIL.md +1 -0
  75. package/docs/DETAIL.zh.md +1 -0
  76. package/docs/pin-compare.png +0 -0
  77. package/docs/pin-modes.png +0 -0
  78. package/docs/preview.svg +84 -0
  79. package/docs/shot-fix7.png +0 -0
  80. package/docs/shot-frame-ocean.png +0 -0
  81. package/docs/shot-metal.png +0 -0
  82. package/docs/shot-stars.png +0 -0
  83. package/docs/shot-zones.png +0 -0
  84. package/icon.svg +5 -0
  85. package/index.js +2015 -0
  86. package/locale/en.json +7 -0
  87. package/locale/zh.json +7 -0
  88. package/package.json +58 -3
  89. package/pin.ps1 +172 -0
  90. package/rollback.ps1 +196 -0
  91. package/tools/__pycache__/pack-release.cpython-312.pyc +0 -0
  92. package/tools/_slice.txt +9 -0
  93. package/tools/boot.cjs +16 -0
  94. package/tools/build-frame-css.cjs +33 -0
  95. package/tools/check-docs.ps1 +41 -0
  96. package/tools/check-names.ps1 +35 -0
  97. package/tools/extract.cjs +28 -0
  98. package/tools/find-in-asar.cjs +43 -0
  99. package/tools/list-dir.cjs +21 -0
  100. package/tools/list-pkgs.cjs +10 -0
  101. package/tools/probe-delay.cjs +109 -0
  102. package/tools/probe-star-icon.cjs +164 -0
  103. package/tools/proof-glow-persist.cjs +102 -0
  104. package/tools/proof-migration.cjs +88 -0
  105. package/tools/proof-opacity.cjs +153 -0
  106. package/tools/proof-race.cjs +103 -0
  107. package/tools/run-asar.ps1 +53 -0
  108. package/tools/run.cmd +8 -0
  109. package/tools/scan.cjs +24 -0
  110. package/tools/smoke.cjs +179 -0
  111. package/tools/source-health.cjs +165 -0
  112. package/tools/splice.cjs +20 -0
  113. package/tools/test-account.cjs +74 -0
  114. package/tools/test-client.cjs +265 -0
  115. package/tools/test-dom.cjs +258 -0
  116. package/tools/test-host.cjs +500 -0
  117. package/tools/test-menu.cjs +591 -0
  118. package/tools/test-recharge.cjs +111 -0
  119. package/tools/test-v20.cjs +1793 -0
  120. package/workspace-pin.cmd +8 -0
@@ -0,0 +1,591 @@
1
+ // test-menu.cjs — 用最小 DOM 复现 DSH 真实右键菜单结构,验证 B1/B2/B3。
2
+ // usage: run-asar.ps1 test-menu.cjs <client.js 绝对路径>
3
+ module.exports = async function (args) {
4
+ const fs = require('node:fs');
5
+ const vm = require('node:vm');
6
+ const src = fs.readFileSync(args[0], 'utf8');
7
+
8
+ const problems = [];
9
+ const expect = (ok, msg) => { if (!ok) problems.push(msg); return ok; };
10
+
11
+ /* ---------------- 最小 DOM ---------------- */
12
+ const DOC = { isDocument: true };
13
+ const observers = [];
14
+ const intervals = new Map();
15
+ let intervalSeq = 0;
16
+
17
+ class Style {
18
+ constructor() { this.v = {}; }
19
+ setProperty(k, x) { this.v[k] = String(x); }
20
+ removeProperty(k) { delete this.v[k]; }
21
+ getPropertyValue(k) { return this.v[k] || ''; }
22
+ }
23
+ class ClassList {
24
+ constructor(n) { this.n = n; }
25
+ _l() { return (this.n.attrs.class || '').split(/\s+/).filter(Boolean); }
26
+ _s(l) { this.n.attrs.class = l.join(' '); }
27
+ add(c) { const l = this._l(); if (!l.includes(c)) l.push(c); this._s(l); }
28
+ remove(c) { this._s(this._l().filter(x => x !== c)); }
29
+ toggle(c, f) { const has = this._l().includes(c); const want = f === undefined ? !has : !!f; if (want) this.add(c); else this.remove(c); return want; }
30
+ contains(c) { return this._l().includes(c); }
31
+ }
32
+
33
+ function parseCompound(part) {
34
+ const tagMatch = /^([a-zA-Z][\w-]*|\*)/.exec(part);
35
+ const tag = tagMatch ? tagMatch[1] : null;
36
+ const attrs = [];
37
+ const re = /\[([^\]]+)\]/g;
38
+ let m;
39
+ while ((m = re.exec(part)) !== null) {
40
+ const body = m[1];
41
+ let am = /^([\w-]+)$/.exec(body);
42
+ if (am) { attrs.push({ name: am[1], op: 'has' }); continue; }
43
+ am = /^([\w-]+)\s*([*^$]?)=\s*"([^"]*)"$/.exec(body);
44
+ if (am) { attrs.push({ name: am[1], op: (am[2] || '') + '=', value: am[3] }); continue; }
45
+ am = /^([\w-]+)\s*([*^$]?)=\s*'([^']*)'$/.exec(body);
46
+ if (am) { attrs.push({ name: am[1], op: (am[2] || '') + '=', value: am[3] }); }
47
+ }
48
+ return { tag, attrs };
49
+ }
50
+ function matchCompound(node, part) {
51
+ if (node.nodeType !== 1) return false;
52
+ const { tag, attrs } = parseCompound(part);
53
+ if (tag && tag !== '*' && String(node.tagName).toLowerCase() !== tag.toLowerCase()) return false;
54
+ for (const a of attrs) {
55
+ const v = node.getAttribute(a.name);
56
+ if (a.op === 'has') { if (v === null) return false; continue; }
57
+ if (v === null) return false;
58
+ if (a.op === '=' && v !== a.value) return false;
59
+ if (a.op === '*=' && v.indexOf(a.value) === -1) return false;
60
+ if (a.op === '^=' && v.indexOf(a.value) !== 0) return false;
61
+ if (a.op === '$=' && !v.endsWith(a.value)) return false;
62
+ }
63
+ return true;
64
+ }
65
+ function matchesComplex(node, selector) {
66
+ const parts = selector.trim().split(/\s+/).filter(Boolean);
67
+ if (parts.length === 0) return false;
68
+ if (!matchCompound(node, parts[parts.length - 1])) return false;
69
+ let current = node.parentNode;
70
+ let i = parts.length - 2;
71
+ while (i >= 0 && current && current !== DOC) {
72
+ if (matchCompound(current, parts[i])) i -= 1;
73
+ current = current.parentNode;
74
+ }
75
+ return i < 0;
76
+ }
77
+ const matches = (node, selector) => String(selector).split(',').some(part => matchesComplex(node, part.trim()));
78
+
79
+ class Node {
80
+ constructor(tag) {
81
+ this.tagName = String(tag).toUpperCase();
82
+ this.children = [];
83
+ this.attrs = {};
84
+ this.parentNode = null;
85
+ this.style = new Style();
86
+ this.listeners = {};
87
+ this.text = '';
88
+ this.nodeType = 1;
89
+ this.classList = new ClassList(this);
90
+ this.rect = { top: 40, bottom: 72, height: 32, width: 260, left: 0, right: 260 };
91
+ }
92
+ get isConnected() { let n = this; while (n) { if (n === DOC) return true; n = n.parentNode; } return false; }
93
+ appendChild(c) { if (c.parentNode) c.remove(); c.parentNode = this; this.children.push(c); return c; }
94
+ insertBefore(c) { return this.appendChild(c); }
95
+ removeChild(c) { const i = this.children.indexOf(c); if (i !== -1) this.children.splice(i, 1); c.parentNode = null; }
96
+ remove() { if (this.parentNode) this.parentNode.removeChild(this); }
97
+ contains(n) { let c = n; while (c) { if (c === this) return true; c = c.parentNode; } return false; }
98
+ setAttribute(k, v) { this.attrs[k] = String(v); }
99
+ getAttribute(k) { return k in this.attrs ? this.attrs[k] : null; }
100
+ hasAttribute(k) { return k in this.attrs; }
101
+ removeAttribute(k) { delete this.attrs[k]; }
102
+ addEventListener(t, h) { (this.listeners[t] = this.listeners[t] || []).push(h); }
103
+ removeEventListener(t, h) { const l = this.listeners[t] || []; const i = l.indexOf(h); if (i !== -1) l.splice(i, 1); }
104
+ dispatch(t, extra) {
105
+ const ev = Object.assign({
106
+ type: t, target: this, defaultPrevented: false, propagationStopped: false,
107
+ preventDefault() { this.defaultPrevented = true; }, stopPropagation() { this.propagationStopped = true; },
108
+ }, extra || {});
109
+ for (const h of (this.listeners[t] || [])) h(ev);
110
+ return ev;
111
+ }
112
+ getBoundingClientRect() { return this.rect; }
113
+ matches(s) { return matches(this, s); }
114
+ get id() { return this.attrs.id || ''; }
115
+ set id(v) { this.attrs.id = String(v); }
116
+ get type() { return this.attrs.type || ''; }
117
+ set type(v) { this.attrs.type = String(v); }
118
+ get value() { return this._value === undefined ? (this.attrs.value || '') : this._value; }
119
+ set value(v) { this._value = String(v); this.attrs.value = String(v); }
120
+ get textContent() { return this.text || this.children.map(c => c.textContent).join(''); }
121
+ set textContent(v) { this.text = String(v); this.children = []; }
122
+ get outerHTML() {
123
+ const name = String(this.tagName).toLowerCase();
124
+ const attrs = Object.keys(this.attrs).map(k => ' ' + k + '="' + this.attrs[k] + '"').join('');
125
+ const inner = this.text || this.children.map(c => c.outerHTML || c.textContent || '').join('');
126
+ return '<' + name + attrs + '>' + inner + '</' + name + '>';
127
+ }
128
+ walk(out) { for (const c of this.children) { out.push(c); c.walk(out); } return out; }
129
+ querySelectorAll(s) { return this.walk([]).filter(n => matches(n, s)); }
130
+ querySelector(s) { return this.querySelectorAll(s)[0] || null; }
131
+ }
132
+ class MO { constructor(cb) { this.cb = cb; observers.push(this); } observe() {} disconnect() { this.disconnected = true; } }
133
+
134
+ const html = new Node('html');
135
+ const body = new Node('body');
136
+ html.appendChild(body); html.parentNode = DOC;
137
+ const document = {
138
+ body, head: html, documentElement: html, nodeType: 9,
139
+ createElement: t => new Node(t),
140
+ createElementNS: (_n, t) => new Node(t),
141
+ createTextNode: v => { const n = new Node('#text'); n.nodeType = 3; n.text = String(v); return n; },
142
+ querySelector: s => html.querySelector(s),
143
+ querySelectorAll: s => html.querySelectorAll(s),
144
+ getElementById: id => html.querySelectorAll('[id]').find(n => n.getAttribute('id') === id) || null,
145
+ addEventListener() {}, removeEventListener() {},
146
+ };
147
+
148
+ /* ---------------- 菜单构造(照抄 DSH 真实结构) ---------------- */
149
+ function itemWrap(label, iconKind) {
150
+ const wrap = new Node('div');
151
+ wrap.setAttribute('class', '_itemWrap_70kcw_173');
152
+ const button = new Node('button');
153
+ button.setAttribute('type', 'button');
154
+ button.setAttribute('role', 'menuitem');
155
+ button.setAttribute('class', '_item_70kcw_173');
156
+ const iconSpan = new Node('span');
157
+ iconSpan.setAttribute('aria-hidden', 'true');
158
+ iconSpan.setAttribute('class', '_itemIcon_70kcw_233');
159
+ const svg = new Node('svg');
160
+ if (iconKind === 'native-pin') {
161
+ svg.setAttribute('data-icon', 'dsw-icon-pin-outline-regular');
162
+ const use = new Node('use');
163
+ use.setAttribute('href', '#dsw-icon-pin-outline-regular');
164
+ svg.appendChild(use);
165
+ } else if (iconKind === 'native-unpin') {
166
+ svg.setAttribute('data-icon', 'dsw-icon-pin-fill-regular');
167
+ const use = new Node('use');
168
+ use.setAttribute('href', '#dsw-icon-pin-fill-regular');
169
+ svg.appendChild(use);
170
+ } else if (iconKind === 'ours-pin') {
171
+ svg.setAttribute('viewBox', '0 0 16 16');
172
+ svg.setAttribute('data-wp-icon', 'pushpin');
173
+ const path = new Node('path');
174
+ path.setAttribute('d', 'M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707');
175
+ svg.appendChild(path);
176
+ } else if (iconKind === 'ours-pin-path') {
177
+ // 只靠 path 认自己的兜底路径(没有 data-wp-icon 标记)
178
+ svg.setAttribute('viewBox', '0 0 16 16');
179
+ const path = new Node('path');
180
+ path.setAttribute('d', 'M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707');
181
+ svg.appendChild(path);
182
+ } else if (iconKind === 'ours-mountain') {
183
+ svg.setAttribute('viewBox', '0 0 16 16');
184
+ svg.setAttribute('data-wp-icon', 'mountain');
185
+ const path = new Node('path');
186
+ path.setAttribute('d', 'M1.4 13.2 L5.9 3.6 L8.6 8.5 L10.6 5.2 L14.6 13.2 Z');
187
+ svg.appendChild(path);
188
+ } else if (iconKind === 'star') {
189
+ const path = new Node('path');
190
+ path.setAttribute('d', 'M8 1.7 L9.9 5.5 L14.1 6.1 L11.1 9.1 L11.8 13.3 L8 11.3 L4.2 13.3 L4.9 9.1 L1.9 6.1 L6.1 5.5 Z');
191
+ svg.appendChild(path);
192
+ } else {
193
+ const path = new Node('path');
194
+ path.setAttribute('d', 'M2 8h12');
195
+ svg.appendChild(path);
196
+ }
197
+ iconSpan.appendChild(svg);
198
+ const labelSpan = new Node('span');
199
+ labelSpan.setAttribute('class', '_itemLabel_70kcw_276');
200
+ labelSpan.text = label;
201
+ button.appendChild(iconSpan);
202
+ button.appendChild(labelSpan);
203
+ wrap.appendChild(button);
204
+ return { wrap, button, svg, labelSpan };
205
+ }
206
+ function menuPortal(items) {
207
+ const root = new Node('div');
208
+ root.setAttribute('data-context-menu', '');
209
+ root.setAttribute('role', 'menu');
210
+ root.setAttribute('class', '_portal_70kcw_43 _list_70kcw_7');
211
+ const viewport = new Node('div');
212
+ viewport.setAttribute('class', '_viewport_70kcw_19');
213
+ viewport.setAttribute('role', 'presentation');
214
+ for (const entry of items) viewport.appendChild(entry.wrap);
215
+ root.appendChild(viewport);
216
+ return { root, viewport };
217
+ }
218
+ function visiblePinLabels(root) {
219
+ return root.querySelectorAll('button[role="menuitem"]')
220
+ .filter(b => {
221
+ const wrap = b.parentNode;
222
+ if (wrap && wrap.style && wrap.style.display === 'none') return false;
223
+ if (b.style && b.style.display === 'none') return false;
224
+ return /置顶/.test(b.textContent);
225
+ })
226
+ .map(b => b.textContent);
227
+ }
228
+
229
+ /* ---------------- 状态 / fetch ---------------- */
230
+ const requests = [];
231
+ let debugEnabled = true;
232
+ let remote = {
233
+ pinnedWorkspaceId: 'w-a', starredWorkspaces: [], starredSessions: [],
234
+ workspaceIds: ['w-a', 'w-b'], pinnedSessionByWorkspace: {},
235
+ settings: { nativeSessionPin: 'plugin', workspaceStarColor: '#E5484D', sessionStarColor: '#E8B93B', sessionTitleChars: 7 },
236
+ };
237
+ const reply = v => ({ ok: true, status: 200, json: async () => v });
238
+ const workspacesService = {
239
+ list: { getSnapshot: () => ({ items: [{ workspaceId: 'w-a', sessionIds: ['s-1'] }], pinnedSessionIds: [] }), subscribe: () => () => {} },
240
+ pinSession: async () => {}, unpinSession: async () => {},
241
+ };
242
+ const sandbox = {
243
+ console, URL, setTimeout, clearTimeout,
244
+ setInterval: fn => { const id = ++intervalSeq; intervals.set(id, fn); return id; },
245
+ clearInterval: id => intervals.delete(id),
246
+ queueMicrotask: fn => Promise.resolve().then(fn),
247
+ MutationObserver: MO, document,
248
+ window: {
249
+ __ModuleLoader__: { load: e => (sandbox.__entry = e) },
250
+ location: { href: 'http://127.0.0.1:49696/?t=1' },
251
+ innerWidth: 1280, innerHeight: 800,
252
+ },
253
+ fetch: async (url, init) => {
254
+ const method = (init && init.method) || 'GET';
255
+ const body = init && init.body ? JSON.parse(init.body) : undefined;
256
+ requests.push({ url, method, body });
257
+ if (url.endsWith('/debug') && method === 'GET') return reply({ enabled: debugEnabled });
258
+ if (url.endsWith('/debug') && method === 'POST') return reply({ written: 'menu-dump.html' });
259
+ if (url.endsWith('/state')) return reply(remote);
260
+ if (url.endsWith('/setting')) {
261
+ remote = Object.assign({}, remote, { settings: Object.assign({}, remote.settings, { [body.key]: body.value }) });
262
+ return reply(remote);
263
+ }
264
+ return reply(remote);
265
+ },
266
+ };
267
+ vm.createContext(sandbox);
268
+ vm.runInContext(src, sandbox, { filename: args[0] });
269
+ const React = { createElement: () => null };
270
+ const plugin = sandbox.__entry.factory(n => { if (n === 'react') return React; throw new Error(n); });
271
+ const ctx = {
272
+ effect(fn) { fn(); return () => {}; }, on() { return () => {}; },
273
+ get(name) { return name === 'workspaces' ? workspacesService : undefined; },
274
+ locale: { register: () => () => {}, bind: () => k => String(k) },
275
+ slots: { inject(_n, f) { const it = f(); if (it && it.next) { for (const _ of it) { /* drain */ } } return () => {}; }, register() { return () => {}; } },
276
+ contextMenus: { register() { return () => {}; }, notify() {} },
277
+ };
278
+ plugin.apply(ctx);
279
+ await new Promise(r => setTimeout(r, 30));
280
+ const pin = sandbox.window.__workspacePin;
281
+ expect(!!pin, '应挂出 window.__workspacePin');
282
+ const tick = async () => { for (const fn of intervals.values()) fn(); await new Promise(r => setTimeout(r, 40)); };
283
+
284
+ /* ---------------- 侧栏数据行 ---------------- */
285
+ const makeRow = (kind, id, title) => {
286
+ const row = new Node('div');
287
+ row.setAttribute('data-row-key', kind + ':' + id);
288
+ row.setAttribute('role', 'treeitem');
289
+ row.setAttribute('aria-label', title);
290
+ const titleEl = new Node('span');
291
+ titleEl.setAttribute('class', 'Rows_title__x');
292
+ titleEl.text = title;
293
+ row.appendChild(titleEl);
294
+ body.appendChild(row);
295
+ return { row, titleEl };
296
+ };
297
+ // 关键回归:标题含「置顶」的会话行 + 行内原生图钉按钮
298
+ const dinghai = makeRow('session', 's-dinghai', '工作区置顶插件可行性开发');
299
+ const rowPinBtn = new Node('button');
300
+ rowPinBtn.setAttribute('class', 'Rows_iconButton__x Rows_pinnedAction__x');
301
+ rowPinBtn.setAttribute('aria-label', '置顶会话');
302
+ dinghai.row.appendChild(rowPinBtn);
303
+ // 三点 ⋯:aria-label 里带完整标题(标题含「置顶」),绝不能被当成原生置顶按钮藏掉
304
+ const rowMenuBtn = new Node('button');
305
+ rowMenuBtn.setAttribute('class', 'Rows_iconButton__x');
306
+ rowMenuBtn.setAttribute('data-context-menu-trigger', '');
307
+ rowMenuBtn.setAttribute('aria-haspopup', 'menu');
308
+ rowMenuBtn.setAttribute('aria-label', '会话“工作区置顶插件可行性开发”的操作');
309
+ dinghai.row.appendChild(rowMenuBtn);
310
+ // 模拟旧版 contains 判定留下的误藏:新代码必须在下一轮把它恢复
311
+ rowMenuBtn.style.display = 'none';
312
+ rowMenuBtn.setAttribute('data-wp-hidden-inline', '1');
313
+
314
+ /* ---------------- B1/B2:未置顶会话菜单 ---------------- */
315
+ const nativePin = itemWrap('置顶会话', 'native-pin');
316
+ const ourPin = itemWrap('置顶会话', 'ours-pin');
317
+ const starItem = itemWrap('星标会话', 'star');
318
+ const renameItem = itemWrap('重命名', 'other');
319
+ const unpinnedMenu = menuPortal([nativePin, ourPin, starItem, renameItem]);
320
+ body.appendChild(unpinnedMenu.root);
321
+
322
+ await tick();
323
+
324
+ expect(nativePin.wrap.style.display === 'none', 'B1 未置顶:原生「置顶会话」应被隐藏');
325
+ expect(ourPin.wrap.style.display !== 'none', 'B1 未置顶:插件「置顶会话」必须保留');
326
+ expect(visiblePinLabels(unpinnedMenu.root).length === 1, 'B1 未置顶:菜单里应只剩 1 条置顶项,实际 ' + visiblePinLabels(unpinnedMenu.root).length);
327
+ expect(ourPin.button.getAttribute('data-wp-menu-item') === 'session-pin', 'B1:插件项应打上 data-wp-menu-item 标记');
328
+ expect(dinghai.row.style.display !== 'none', '标题含「置顶」的会话行不许被隐藏');
329
+ expect(dinghai.titleEl.getAttribute('data-wp-full') === '工作区置顶插件可行性开发', '会话标题应完整保留在 data-wp-full(只做字数截断,不许丢文本)');
330
+ expect(rowPinBtn.style.display === 'none', '行内原生图钉按钮应被隐藏(这个是按钮级的,正确)');
331
+ expect(rowMenuBtn.style.display !== 'none', 'B1 回归:标题含「置顶」的行,三点 ⋯ 不许被藏(aria-label 是"…的操作")');
332
+ expect(rowMenuBtn.getAttribute('data-wp-hidden-inline') === null, 'B1 回归:旧版误藏的 ⋯ 必须被自愈恢复');
333
+ expect(dinghai.row.getAttribute('data-wp-hidden-inline') === null, '数据行不许有 data-wp-hidden-inline');
334
+
335
+ const dumpPost = requests.filter(r => r.url.endsWith('/debug') && r.method === 'POST');
336
+ expect(dumpPost.length >= 1, 'B2:flag 开时应 POST /debug');
337
+ if (dumpPost.length > 0) {
338
+ const d = dumpPost[dumpPost.length - 1].body;
339
+ expect(String(d.html).indexOf('data-context-menu') !== -1, 'B2:dump 抓到的应是弹层根(含 data-context-menu)');
340
+ expect(String(d.html).indexOf('_itemWrap_') !== -1, 'B2:dump 里应包含菜单项');
341
+ expect(String(d.mode).indexOf('unpinned-session') !== -1, 'B2:mode 应标注未置顶会话,实际 ' + d.mode);
342
+ expect(String(d.mode).indexOf('nativePin=1') !== -1, 'B2:mode 应统计出 1 条原生置顶项,实际 ' + d.mode);
343
+ expect(/^(?:0|1)\.\d+\.\d+$/.test(String(d.version)), 'B2:dump 应带客户端版本,实际 ' + d.version);
344
+ expect(Array.isArray(d.roots) && d.roots.length === 1, 'B2:#roots 应列出 1 个候选弹层');
345
+ expect(Array.isArray(d.list) && d.list.length === 4, 'B2:#items 应列出 4 个菜单项');
346
+ }
347
+
348
+ /* ---------------- B1:已置顶会话菜单 ---------------- */
349
+ body.removeChild(unpinnedMenu.root);
350
+ const nativeUnpin = itemWrap('取消置顶', 'native-unpin');
351
+ const ourUnpin = itemWrap('取消置顶会话', 'ours-pin-path');
352
+ const pinnedMenu = menuPortal([nativeUnpin, ourUnpin, starItem, renameItem]);
353
+ body.appendChild(pinnedMenu.root);
354
+ await tick();
355
+ expect(nativeUnpin.wrap.style.display === 'none', 'B1 已置顶:原生「取消置顶」应被隐藏');
356
+ expect(ourUnpin.wrap.style.display !== 'none', 'B1 已置顶:插件「取消置顶会话」必须保留');
357
+ expect(visiblePinLabels(pinnedMenu.root).length === 1, 'B1 已置顶:菜单里应只剩 1 条,实际 ' + visiblePinLabels(pinnedMenu.root).length);
358
+
359
+ /* ---------------- B1:工作区菜单不许误伤 ---------------- */
360
+ body.removeChild(pinnedMenu.root);
361
+ const wsPin = itemWrap('取消置顶', 'ours-mountain'); // 插件的「取消置顶工作区」
362
+ const wsStar = itemWrap('星标工作区', 'star');
363
+ const newSession = itemWrap('新会话', 'other');
364
+ const wsMenu = menuPortal([wsPin, wsStar, newSession]);
365
+ body.appendChild(wsMenu.root);
366
+ await tick();
367
+ expect(wsPin.wrap.style.display !== 'none', 'B1:工作区菜单的「取消置顶」不许被误伤');
368
+ expect(visiblePinLabels(wsMenu.root).length === 1, 'B1:工作区菜单应仍只有 1 条置顶项');
369
+
370
+ /* ---------------- B1:native 模式不隐藏任何原生项 ---------------- */
371
+ body.removeChild(wsMenu.root);
372
+ remote = Object.assign({}, remote, { settings: Object.assign({}, remote.settings, { nativeSessionPin: 'native' }) });
373
+ await tick();
374
+ pin.sync();
375
+ await new Promise(r => setTimeout(r, 20));
376
+ const nativeOnly = itemWrap('置顶会话', 'native-pin');
377
+ const ourItemInNative = itemWrap('置顶会话', 'ours-pin');
378
+ const nativeMenu = menuPortal([nativeOnly, ourItemInNative]);
379
+ body.appendChild(nativeMenu.root);
380
+ await tick();
381
+ expect(nativeOnly.wrap.style.display !== 'none', 'v0.18:native 模式保留 DSH 原生置顶菜单项(成对切换)');
382
+ expect(ourItemInNative.wrap.style.display !== 'none', 'v0.18:native 模式插件项仍存在,但插件不再自己追加(由 resolve 侧按模式决定)');
383
+ body.removeChild(nativeMenu.root);
384
+
385
+ remote = Object.assign({}, remote, { settings: Object.assign({}, remote.settings, { nativeSessionPin: 'plugin' }) });
386
+ await tick();
387
+
388
+ /* ---------------- B2:flag 关掉时不 dump ---------------- */
389
+ debugEnabled = false;
390
+ const before = requests.filter(r => r.url.endsWith('/debug') && r.method === 'POST').length;
391
+ const m2 = menuPortal([itemWrap('置顶会话', 'native-pin'), itemWrap('置顶会话', 'ours-pin')]);
392
+ body.appendChild(m2.root);
393
+ await tick();
394
+ const after = requests.filter(r => r.url.endsWith('/debug') && r.method === 'POST').length;
395
+ expect(after === before, 'B2:flag 关掉后不应再写 dump');
396
+ body.removeChild(m2.root);
397
+
398
+ /* ---------------- B3:齿轮位置 + 四项设置 + 恢复默认 ---------------- */
399
+ const headerRow = new Node('div');
400
+ headerRow.setAttribute('class', '_sectionHeader_abc');
401
+ headerRow.setAttribute('data-sidebar-workspace-header', '');
402
+ const headerLabel = new Node('span');
403
+ headerLabel.setAttribute('class', '_sectionLabel_abc');
404
+ headerLabel.text = '工作区';
405
+ headerRow.appendChild(headerLabel);
406
+ const searchSlot = new Node('div');
407
+ searchSlot.setAttribute('class', '_searchSlot_abc');
408
+ const searchBtn = new Node('button');
409
+ searchBtn.setAttribute('aria-label', '搜索会话');
410
+ searchSlot.appendChild(searchBtn);
411
+ headerRow.appendChild(searchSlot);
412
+ const headerActions = new Node('div');
413
+ headerActions.setAttribute('class', '_headerActions_abc');
414
+ const viewBtn = new Node('button');
415
+ viewBtn.setAttribute('aria-label', '视图选项');
416
+ headerActions.appendChild(viewBtn);
417
+ const addBtn = new Node('button');
418
+ addBtn.setAttribute('aria-label', '添加工作区');
419
+ headerActions.appendChild(addBtn);
420
+ headerRow.appendChild(headerActions);
421
+ body.appendChild(headerRow);
422
+
423
+ await tick(); // 1s 定时器 → place()
424
+ const gear = document.querySelectorAll('[data-wp-settings-toggle]')[0];
425
+ expect(!!gear, 'B3:应存在设置齿轮');
426
+ if (gear) {
427
+ // DSH 的 .headerActions 是 flex:none + max-width:60px + overflow:hidden(只够两个 28px 按钮),
428
+ // 第三个孩子会被裁掉(实测齿轮被挤到 x=277,而侧栏右边界只有 276)→ 必须挂在标题行本身。
429
+ expect(gear.parentNode === headerRow, 'B3:齿轮应挂在「工作区」标题行本身,不能塞进 headerActions(会被 max-width:60px 裁掉)');
430
+ expect(headerRow.children[headerRow.children.length - 1] === gear, 'B3:齿轮应是标题行最后一个(搜索/排序/新建工作区之后)');
431
+ expect(headerActions.children.length === 2, 'B3:动作区仍只放「视图选项 + 新建工作区」两个按钮,不被挤占');
432
+ expect(gear.style.display !== 'none', 'B3:齿轮应可见');
433
+ expect(gear.style.flex === '0 0 auto', 'B3:齿轮不能被 flex 压扁');
434
+ }
435
+ const panel = document.querySelectorAll('[data-wp-settings-panel]')[0];
436
+ expect(!!panel, 'B3:应存在设置面板');
437
+
438
+ const colorInputs = panel.querySelectorAll('input[type="color"]');
439
+ expect(colorInputs.length === 2, 'B3:应有两个颜色输入(工作区/会话),实际 ' + colorInputs.length);
440
+ const selects = panel.querySelectorAll('select');
441
+ expect(selects.length === 3, 'B3:应有三个下拉(样式主题 + 置顶样式 + 标题字数),实际 ' + selects.length);
442
+ const optionsOf = sel => (sel.options ? Array.from(sel.options) : sel.children.filter(c => c.tagName === 'OPTION'));
443
+ const titleSelect = panel.querySelector('[data-wp-title-chars]');
444
+ const themeSelect = selects.filter(s => optionsOf(s).some(o => o.value === 'glass'))[0];
445
+ const modeSelect = selects.filter(s => s !== themeSelect && s !== titleSelect)[0];
446
+ expect(!!themeSelect && !!modeSelect && !!titleSelect, 'B3:三个下拉都应能定位');
447
+ if (themeSelect) {
448
+ const themeOptions = optionsOf(themeSelect);
449
+ expect(themeOptions.length === 8, 'B3:样式主题应有 8 个选项(含旧日/波普/蒸汽波),实际 ' + themeOptions.length);
450
+ const values = themeOptions.map(o => o.value).join(',');
451
+ expect(values === 'metal,glass,neon,minimal,ocean,oldday,pop,vaporwave', 'B3:主题顺序应为 metal,glass,neon,minimal,ocean,oldday,pop,vaporwave,实际 ' + values);
452
+ expect(themeSelect.value === 'metal', 'B3:默认主题应为 metal,实际 ' + themeSelect.value);
453
+ }
454
+ const titleInput = titleSelect;
455
+ expect(!!titleInput, '#5:应有标题字数字段(data-wp-title-chars)');
456
+ if (titleSelect) {
457
+ const titleOptions = optionsOf(titleSelect);
458
+ const titleValues = titleOptions.map(o => o.value).join(',');
459
+ expect(titleValues === '2,3,4,5,6,7,8,9,10,11,12,13', '#5:标题字数应为 2–12 + 无限(13),实际 ' + titleValues);
460
+ expect(titleOptions[titleOptions.length - 1].textContent === '无限', '#5:最后一档文案应为「无限」');
461
+ }
462
+ expect(panel.textContent.indexOf('会话置顶样式') !== -1, '#4:文案应为「会话置顶样式」');
463
+ expect(panel.textContent.indexOf('会话图钉样式') === -1, '#4:不应再出现旧文案「会话图钉样式」');
464
+ const checkboxes = panel.querySelectorAll('input[type="checkbox"]');
465
+ // v0.21:v0.20 的两个总开关 + T-01 的两条告警开关,共 4 个;旧的「不限」勾选框仍不许回来
466
+ const KNOWN_SWITCHES = ['data-wp-token-switch', 'data-wp-avatar-switch', 'data-wp-limit-alert-switch', 'data-wp-balance-alert-switch', 'data-wp-glow-alert-switch', 'data-wp-theme-enabled-switch', 'data-wp-balance-time-switch'];
467
+ expect(checkboxes.length === 7, '#5/v0.21:复选框应是 7 个已知开关(含「显示更新时间」「使用样式主题」),实际 ' + checkboxes.length);
468
+ expect(checkboxes.every(b => KNOWN_SWITCHES.some(a => b.hasAttribute(a))),
469
+ '#5:不允许出现计划外的勾选框(尤其旧版「不限」)');
470
+ if (colorInputs.length === 2 && themeSelect && modeSelect && titleSelect) {
471
+ colorInputs[0].value = '#112233';
472
+ colorInputs[0].dispatch('input');
473
+ await new Promise(r => setTimeout(r, 30));
474
+ expect(requests.some(r => r.url.endsWith('/setting') && r.body.key === 'workspaceStarColor' && r.body.value === '#112233'), 'B3:工作区星标色应写回 host');
475
+ expect(html.style.getPropertyValue('--wp-ws-star') === '#112233', 'B3:工作区星标色应即时生效');
476
+
477
+ colorInputs[1].value = '#445566';
478
+ colorInputs[1].dispatch('input');
479
+ await new Promise(r => setTimeout(r, 30));
480
+ expect(requests.some(r => r.url.endsWith('/setting') && r.body.key === 'sessionStarColor' && r.body.value === '#445566'), 'B3:会话星标色应写回 host');
481
+
482
+ themeSelect.value = 'glass';
483
+ themeSelect.dispatch('change');
484
+ await new Promise(r => setTimeout(r, 30));
485
+ expect(requests.some(r => r.url.endsWith('/setting') && r.body.key === 'theme' && r.body.value === 'glass'), 'B3:样式主题应写回 host');
486
+ expect(html.getAttribute('data-wp-theme') === 'glass', 'B3:切主题应即时生效(html[data-wp-theme]),实际 ' + html.getAttribute('data-wp-theme'));
487
+
488
+ modeSelect.value = 'native';
489
+ modeSelect.dispatch('change');
490
+ await new Promise(r => setTimeout(r, 30));
491
+ expect(requests.some(r => r.url.endsWith('/setting') && r.body.key === 'nativeSessionPin' && r.body.value === 'native'), 'B3:置顶方式应写回 host');
492
+ expect(html.classList.contains('wp-pin-native'), 'v0.18:native 模式加 wp-pin-native(插件伪元素让位)');
493
+ expect(!html.classList.contains('wp-native-off'), 'v0.18:native 模式不再隐藏 DSH 原生置顶 UI(成对切换)');
494
+
495
+ titleInput.value = '12';
496
+ titleInput.dispatch('change');
497
+ await new Promise(r => setTimeout(r, 30));
498
+ expect(requests.some(r => r.url.endsWith('/setting') && r.body.key === 'sessionTitleChars' && Number(r.body.value) === 12), '#5:选 12 应提交 12 字截断');
499
+
500
+ titleInput.value = '2';
501
+ titleInput.dispatch('change');
502
+ await new Promise(r => setTimeout(r, 30));
503
+ expect(requests.some(r => r.url.endsWith('/setting') && r.body.key === 'sessionTitleChars' && Number(r.body.value) === 2), '#5:下限应为 2');
504
+
505
+ titleInput.value = '13';
506
+ titleInput.dispatch('change');
507
+ await new Promise(r => setTimeout(r, 30));
508
+ expect(requests.some(r => r.url.endsWith('/setting') && r.body.key === 'sessionTitleChars' && Number(r.body.value) === 13), '#5:选「无限」应提交 13(host 归一成 0)');
509
+ }
510
+
511
+ const resetBtn = panel.querySelectorAll('button').filter(b => b.textContent === '恢复默认')[0];
512
+ expect(!!resetBtn, 'B3:应有「恢复默认」按钮');
513
+ if (resetBtn) {
514
+ resetBtn.dispatch('click');
515
+ await new Promise(r => setTimeout(r, 100));
516
+ const settings = requests.filter(r => r.url.endsWith('/setting'));
517
+ expect(settings.some(r => r.body.key === 'theme' && r.body.value === 'metal'), 'B3:恢复默认应把主题写回 metal');
518
+ expect(settings.some(r => r.body.key === 'workspaceStarColor' && r.body.value === '#E5484D'), 'B3:恢复默认应写回工作区默认红 #E5484D');
519
+ expect(settings.some(r => r.body.key === 'sessionStarColor' && r.body.value === '#E8B93B'), 'B3:恢复默认应写回会话默认黄 #E8B93B');
520
+ expect(settings.some(r => r.body.key === 'nativeSessionPin' && r.body.value === 'plugin'), 'B3:恢复默认应写回 plugin');
521
+ expect(settings.some(r => r.body.key === 'sessionTitleChars' && Number(r.body.value) === 7), 'B3:恢复默认应写回 7 字');
522
+ }
523
+
524
+ /* ---------------- B3 回归:重复 apply(热重载/实例重建)不许出现第二个齿轮 ---------------- */
525
+ plugin.apply(ctx);
526
+ await tick();
527
+ const gearsAfter = document.querySelectorAll('[data-wp-settings-toggle]');
528
+ const panelsAfter = document.querySelectorAll('[data-wp-settings-panel]');
529
+ expect(gearsAfter.length === 1, 'B3 回归:重复 apply 后齿轮必须只有 1 个,实际 ' + gearsAfter.length);
530
+ expect(panelsAfter.length === 1, 'B3 回归:重复 apply 后面板必须只有 1 个,实际 ' + panelsAfter.length);
531
+ if (gearsAfter.length === 1) {
532
+ expect(gearsAfter[0].parentNode === headerRow, 'B3 回归:重建后的齿轮仍挂在标题行');
533
+ }
534
+
535
+ /* ---------------- B4:图标只做状态指示,点击一律走右键菜单 ---------------- */
536
+ const sheetText = (document.getElementById('wp-style') || {}).textContent || '';
537
+ expect(src.indexOf('onRowClick') === -1, 'B4:行右端 40px 图标点击命中区应已删除(伪元素收不到 click)');
538
+ // #2:未置顶的图钉/山平时隐藏,悬停才出现(且可点)
539
+ const baseBeforeRule = /\[data-row-key\^="workspace:"\]::before,\[data-row-key\^="session:"\]::before\{([^}]*)\}/.exec(sheetText);
540
+ expect(!!baseBeforeRule && baseBeforeRule[1].indexOf('visibility:hidden') !== -1, '#2:未置顶的图钉平时不可见(但保留占位,避免标题宽度变化)');
541
+ const hoverBeforeRule = /\[data-row-key\]:hover::before\{([^}]*)\}/.exec(sheetText);
542
+ expect(!!hoverBeforeRule && hoverBeforeRule[1].indexOf('visibility:visible') !== -1, '#2:悬停才显示候选图钉');
543
+ const hoverAfterRule = /\[data-row-key\]:hover::after\{([^}]*)\}/.exec(sheetText);
544
+ expect(!hoverAfterRule || hoverAfterRule[1].indexOf('display') === -1, 'B4:悬停星标只能改透明度,不能靠 hover 才出现(REQ-1 要求常驻占位)');
545
+ expect(sheetText.indexOf('[data-row-key="workspace:w-a"]::before') !== -1, 'B4:已置顶工作区应有常亮蓝山规则');
546
+ expect(sheetText.indexOf('[data-row-key="session:s-dinghai"]::before') === -1, 'B4:未置顶会话不应有图钉规则');
547
+ // REQ-1/REQ-2:星标常驻占位 + 工作区五角星 / 会话四芒星(形状必须不同)
548
+ const wsAfterRule = /\[data-row-key\^="workspace:"\]::after\{([^}]*)\}/.exec(sheetText);
549
+ const ssAfterRule = /\[data-row-key\^="session:"\]::after\{([^}]*)\}/.exec(sheetText);
550
+ expect(!!wsAfterRule && !!ssAfterRule, 'REQ-2:工作区/会话都应有星标规则');
551
+ if (wsAfterRule && ssAfterRule) {
552
+ expect(wsAfterRule[1].indexOf('display:block') !== -1, 'REQ-1:星标位必须常驻占位(未点亮也显示低透明度星)');
553
+ expect(wsAfterRule[1] !== ssAfterRule[1], 'REQ-2:工作区与会话的星标 mask 必须不同(五角星 vs 四芒星)');
554
+ }
555
+ expect(sheetText.indexOf('html.wp-pin-native [data-row-key^="session:"]::before') !== -1, 'v0.18:native 模式伪元素图钉让位');
556
+ expect(sheetText.indexOf('[data-row-key^="session:"]:hover [data-wp-hover-pin]') !== -1, 'v0.18:native 悬停候选钉有 hover 规则');
557
+ expect(sheetText.indexOf('--wp-pin-mask') !== -1, '#1:插件图钉仍走 --wp-pin-mask');
558
+ // #7:标题前竖线必须被去掉(所有主题)
559
+ expect(sheetText.indexOf('[class*="sectionLabel"]::before{display:none') !== -1, '#7:工作区标题前的竖线应被移除');
560
+ // #6:账号区交界由素材 footer-frame.css 负责(v0.19.7 起不再叠加插件自己的渐隐带)
561
+ expect(sheetText.indexOf('footer-frame.css') !== -1, '#6:应注入 footer-frame.css 素材');
562
+ expect(sheetText.indexOf('[class*="footArea"]::before') === -1, '#6:插件不再自己画账号区渐隐带(交给素材)');
563
+ // #3:插件控件层级必须低于 DSH 弹层(1100)
564
+ expect(String(gear.style.cssText).indexOf('z-index:1') !== -1, '#3:齿轮 z-index 应降到 1');
565
+ expect(String(panel.style.cssText).indexOf('z-index:1000') !== -1, '#3:面板 z-index 应为 1000(低于菜单 1100)');
566
+ // 五套主题变量必须在同一份样式表里,且规则走变量(加第六套只加变量)
567
+ for (const theme of ['metal', 'glass', 'neon', 'minimal', 'ocean']) {
568
+ expect(sheetText.indexOf(':root[data-wp-theme="' + theme + '"]') !== -1, 'B4:缺少主题变量:' + theme);
569
+ }
570
+ expect(sheetText.indexOf('--wp-box-background') !== -1 && sheetText.indexOf('var(--wp-box-background)') !== -1, 'B4:主题规则应走 CSS 变量');
571
+ expect(sheetText.indexOf('--wp-lid-background') !== -1, 'B4:盖子样式应走 CSS 变量');
572
+ expect(html.getAttribute('data-wp-theme') === 'metal', 'B4:默认主题应为 metal,实际 ' + html.getAttribute('data-wp-theme'));
573
+
574
+ // 工作区菜单:若出现原生置顶项,也必须只剩我们那一条(山形图标认自己)
575
+ const nativeWsPin = itemWrap('置顶工作区', 'native-pin');
576
+ const ourWsUnpin = itemWrap('取消置顶工作区', 'ours-mountain');
577
+ const wsMenu2 = menuPortal([nativeWsPin, ourWsUnpin, itemWrap('星标工作区', 'star')]);
578
+ body.appendChild(wsMenu2.root);
579
+ await tick();
580
+ expect(nativeWsPin.wrap.style.display === 'none', 'B4:工作区菜单里的原生置顶项应被隐藏');
581
+ expect(ourWsUnpin.wrap.style.display !== 'none', 'B4:插件自己的工作区置顶项必须保留');
582
+ body.removeChild(wsMenu2.root);
583
+
584
+ if (problems.length > 0) {
585
+ console.log('FAIL (' + problems.length + ')');
586
+ for (const p of problems) console.log(' - ' + p);
587
+ return 1;
588
+ }
589
+ console.log('PASS:B1 菜单只剩一条 / B2 dump 抓弹层根 / B3 齿轮+五套主题+五项设置+恢复默认 / B4 图标纯状态 / 数据行未被误藏。');
590
+ return 0;
591
+ };