dsh-delete-session 0.2.8 → 0.2.9
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.
- package/README.md +6 -2
- package/package.json +1 -1
- package/src/client.js +142 -8
- package/test/checkbox.dom.test.js +69 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ DSH 侧边栏的会话菜单只有**重命名 / 分叉 / 归档**——归档只
|
|
|
30
30
|
- **跳过 git 仓库内的文件(默认开)** —— 在项目里干过活的对话,产出文件里往往就是项目源码。开启后仓库内的文件一律不碰,避免删一个对话把项目搬空
|
|
31
31
|
- **删除后回到新会话** —— 若删除的正是当前打开的会话,自动切到一个全新会话,而不是落到已不可用的邻居页
|
|
32
32
|
- **默认安全** —— 宿主路由仅限本机回环(回环 socket + 回环 Host 头 + 同源校验);被 DSH 打开占用的会话会被明确拒绝(409),绝不与活跃写者竞争
|
|
33
|
-
-
|
|
33
|
+
- **三种语言** —— 菜单项、对话框与设置页跟随 DSH 界面语言(zh / en);浏览器语言为 ru 时显示俄语(DSH 本身尚未提供 ru 界面,插件自带字典兜底)
|
|
34
34
|
- **零依赖** —— 不引入任何 DSH SDK,所有服务(`sessions` / `sessionPersistence` / `agents` / `workspaceRegistry` / `webServer`)都在调用时通过 cordis 上下文获取
|
|
35
35
|
|
|
36
36
|
### 安装
|
|
@@ -162,6 +162,10 @@ MIT
|
|
|
162
162
|
|
|
163
163
|
## 修复记录
|
|
164
164
|
|
|
165
|
+
**(v0.2.9)** —— 俄语界面 + 修掉拖拽标签里的 `{name}`。
|
|
166
|
+
|
|
167
|
+
- **俄语(`ru`)**:来自社区贡献([#1](https://github.com/DDDMUC/dsh-delete-session/pull/1),作者 [@aleXela17](https://github.com/aleXela17))。98 条词条与中英完全对齐,函数型条目仍然返回数字。DSH 自身没有 ru 语言包,所以俄语浏览器下插件字典优先于宿主翻译;中英路径不变,宿主仍是权威。
|
|
168
|
+
- **修掉拖拽标签的占位符**:`dropRelease` 模板是「松手删除「{name}」」,但插值参数表里没有 `name`,调用处又把标题当裸字符串传进去,于是三种语言都原样显示 `{name}`。现在传 `{ name }`,标题真正进到句子里。
|
|
165
169
|
**(v0.2.8)** —— 删除更快:退避改成指数,批量改成三阶段流水线。
|
|
166
170
|
|
|
167
171
|
- **lease 探测不再固定等 200ms**:活跃会话的第一次探测几乎必然 busy(detach 后 lease 由异步 retirement 释放),原来每条都要先付 200ms。现在 20 → 40 → 80 → 160 → 200(封顶不变),典型情况落在 20–40ms,最坏总等待从 2200ms 降到 1900ms。
|
|
@@ -197,7 +201,7 @@ This plugin puts **Delete** back where you already click: the session row's `...
|
|
|
197
201
|
- **Skip files inside git repositories (on by default)** — a conversation that worked in a project produces that project's source. With this on, nothing inside a repository is touched
|
|
198
202
|
- **Lands on a fresh session** — deleting the session you are looking at switches to a new one instead of an unusable neighbour page
|
|
199
203
|
- **Safe by default** — host routes are loopback-only (loopback socket, loopback Host header, same-origin check); a session the host still holds open is refused with 409 rather than raced
|
|
200
|
-
- **
|
|
204
|
+
- **Three languages** — menu rows, dialog and settings follow the DSH UI language (zh / en), and a Russian browser gets Russian from the bundled dictionary even though DSH itself ships no ru locale
|
|
201
205
|
- **Zero dependencies** — no DSH SDK import; `sessions`, `sessionPersistence`, `agents`, `workspaceRegistry` and `webServer` are all resolved from the cordis context at call time
|
|
202
206
|
|
|
203
207
|
### Install
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-delete-session",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Delete sessions from the DSH Web sidebar: adds a Delete action to the session row menu with a risk-consent dialog, sends the session log, workspace accounting and live session state to the system trash (or removes them outright), and, when opted in, quarantines the files the conversation produced.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/client.js
CHANGED
|
@@ -238,6 +238,109 @@ window.__ModuleLoader__.load({
|
|
|
238
238
|
doneQuarantineFailed: (ok, fail) => `Session deleted, ${ok} quarantined and ${fail} failed`,
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
const ru = {
|
|
242
|
+
menu: 'Удалить сессию',
|
|
243
|
+
multiSelect: 'Выбрать несколько',
|
|
244
|
+
title: 'Удалить сессию',
|
|
245
|
+
descRecycle: 'Сессия и все её записи (журнал, учёт рабочей папки и статистика) будут убраны из списка и перемещены в системную корзину.',
|
|
246
|
+
descPermanent: 'Сессия и все её записи (журнал, учёт рабочей папки и статистика) будут удалены безвозвратно. Отменить это нельзя.',
|
|
247
|
+
cancel: 'Отмена',
|
|
248
|
+
confirm: 'Удалить',
|
|
249
|
+
deleting: 'Удаление…',
|
|
250
|
+
done: 'Сессия удалена',
|
|
251
|
+
failed: 'Не удалось удалить: ',
|
|
252
|
+
busy: 'Сессия сейчас открыта в DSH, удаление не завершилось. Повторите через момент (обычно пара секунд) или перезапустите DSH и попробуйте снова.',
|
|
253
|
+
notFound: 'Сессия не найдена (возможно, она уже удалена).',
|
|
254
|
+
untitled: 'Сессия без названия',
|
|
255
|
+
cancelSelect: 'Отмена',
|
|
256
|
+
selectedCount: (n) => `Выбрано: ${n}`,
|
|
257
|
+
batchRunning: (done, total) => `Удаление ${done}/${total}…`,
|
|
258
|
+
moveSelected: 'Переместить',
|
|
259
|
+
batchMoving: (done, total) => `Перемещение ${done}/${total}…`,
|
|
260
|
+
batchMoved: (ok, fail) => (fail > 0 ? `Перемещено ${ok}, не удалось ${fail}` : `Перемещено ${ok}`),
|
|
261
|
+
moveBadResult: (fields) => `В ответе о перемещении нет полей: ${fields}`,
|
|
262
|
+
deleteSelected: 'Удалить',
|
|
263
|
+
batchDone: (n) => `Удалено сессий: ${n}`,
|
|
264
|
+
batchPartial: (ok, fail) => `Удалено ${ok}, не удалось ${fail}`,
|
|
265
|
+
batchFailed: 'Массовое удаление не удалось: ',
|
|
266
|
+
pageAsk: 'Спрашивать перед удалением',
|
|
267
|
+
pageRecycle: 'Удалять в корзину',
|
|
268
|
+
pageSyncChildren: 'Удалять и дочерние сессии',
|
|
269
|
+
dropHint: 'Перетащите сюда, чтобы удалить',
|
|
270
|
+
dropRelease: 'Отпустите, чтобы удалить «{name}»',
|
|
271
|
+
dropFallback: 'этот диалог',
|
|
272
|
+
starAsk: '⭐ Звёздочка на GitHub сделает автору день',
|
|
273
|
+
starCta: 'Ладно, держи звезду',
|
|
274
|
+
pageSyncChildrenOn: 'Удаление сессии удаляет и порождённые ею сессии субагентов.',
|
|
275
|
+
pageSyncChildrenOff: 'Если выключено, перед удалением появится список дочерних сессий и вы отметите, какие удалить.',
|
|
276
|
+
childrenHint: 'У этого диалога {n} дочерних сессий (субагентов). Отмеченные удалятся вместе с ним.',
|
|
277
|
+
pageRecycleOn: 'Сессия попадёт в системную корзину, её можно восстановить.',
|
|
278
|
+
pageRecycleOff: 'Сессия сразу удаляется с диска, восстановить её нельзя.',
|
|
279
|
+
pageHintAsk: 'Перед каждым удалением сессии показывать подтверждение.',
|
|
280
|
+
pageHintAuto: 'Удалять сессию сразу, не спрашивая.',
|
|
281
|
+
// The produced-file list only exists inside the dialog, so ask mode keeps a
|
|
282
|
+
// delete dialog even when the confirmation above is turned off.
|
|
283
|
+
pageHintAutoWithArtifacts: 'Диалог всё равно откроется: сначала нужно показать список созданных файлов.',
|
|
284
|
+
pageSummaryAsk: 'Спрашивать перед удалением',
|
|
285
|
+
pageSummaryAuto: 'Удалять не спрашивая',
|
|
286
|
+
pageArtifactsOff: 'Не трогать созданные файлы (как сейчас)',
|
|
287
|
+
pageHintArtifactsOff: 'Удаление сессии убирает только её записи и не касается файлов в рабочей папке.',
|
|
288
|
+
pageHintArtifactsOn: 'При удалении сессии разбираются и файлы, которые она трогала в рабочей папке.',
|
|
289
|
+
pageArtifactsAuto: 'Сразу отправлять созданные файлы в карантин',
|
|
290
|
+
pageHintArtifactsAuto: 'Все файлы из области ниже переносятся в карантин без вопросов.',
|
|
291
|
+
pageHintArtifactsAsk: 'При удалении появится список файлов, и вы отметите, какие переносить.',
|
|
292
|
+
pageScopeCreated: 'Только созданные файлы',
|
|
293
|
+
pageScopeAll: 'Созданные и изменённые файлы',
|
|
294
|
+
pageScopeCreatedHint: 'Затрагиваются только файлы, созданные этим диалогом; изменённые им существующие файлы не трогаются.',
|
|
295
|
+
pageScopeAllHint: 'Сюда входят и существующие файлы, которые этот диалог переписал: их перенос изменит то, что уже было в рабочей папке.',
|
|
296
|
+
pageSkipGit: 'Пропускать файлы внутри git-репозитория',
|
|
297
|
+
pageSkipGitOn: 'Обрабатываются только файлы вне git-репозиториев; код из репозитория не переносится.',
|
|
298
|
+
pageSkipGitOff: 'Файлы из репозитория тоже уйдут в карантин: удалив диалог, поработавший в проекте, можно унести и исходники.',
|
|
299
|
+
pageSummaryArtifactsOff: 'Созданные файлы не трогаются',
|
|
300
|
+
pageSummaryArtifactsAuto: 'Созданные файлы — в карантин',
|
|
301
|
+
pageSummaryArtifactsAsk: 'Созданные файлы — спросить',
|
|
302
|
+
pageRootLabel: 'Где хранить карантин',
|
|
303
|
+
pageRootPlaceholder: 'Пусто — путь по умолчанию',
|
|
304
|
+
pageRootBrowse: 'Выбрать папку…',
|
|
305
|
+
pageRootOpen: 'Открыть',
|
|
306
|
+
rootOpened: 'Открыто в файловом менеджере',
|
|
307
|
+
rootOpenFailed: 'Не удалось открыть: ',
|
|
308
|
+
pickerOpening: 'Системный диалог открыт — выберите папку в его окне',
|
|
309
|
+
pickerFailed: 'Не удалось открыть выбор папки: ',
|
|
310
|
+
pageRootReset: 'По умолчанию',
|
|
311
|
+
pageRootDefaultHint: (path) => `Используется путь по умолчанию: ${path}`,
|
|
312
|
+
pageRootCustomHint: 'Карантин создаётся здесь: по подпапке с отметкой времени на каждое удаление',
|
|
313
|
+
pickerTitle: 'Куда переносить файлы в карантин',
|
|
314
|
+
pickerLoading: 'Чтение…',
|
|
315
|
+
pickerEmpty: 'Здесь нет подпапок',
|
|
316
|
+
pickerChoose: 'Выбрать эту папку',
|
|
317
|
+
pickerTruncated: 'Подпапок слишком много: показаны первые 500',
|
|
318
|
+
pickerDefault: (path) => `Путь по умолчанию: ${path}`,
|
|
319
|
+
rootSet: 'Место сохранения обновлено',
|
|
320
|
+
artifactSection: 'Файлы, созданные этим диалогом',
|
|
321
|
+
artifactOpenFolder: 'Открыть папку',
|
|
322
|
+
artifactDeleteFile: 'Удалить этот файл',
|
|
323
|
+
fileDeleted: 'Файл удалён',
|
|
324
|
+
fileRecycled: 'Файл перемещён в корзину',
|
|
325
|
+
fileDeleteFailed: 'Не удалось удалить файл: ',
|
|
326
|
+
revealFailed: 'Не удалось открыть папку: ',
|
|
327
|
+
artifactLoading: 'Сканирование…',
|
|
328
|
+
artifactFailed: 'Сканирование не удалось: ',
|
|
329
|
+
artifactNone: 'Нечего обрабатывать.',
|
|
330
|
+
artifactCount: (created, modified) => `Создано: ${created} · изменено: ${modified}`,
|
|
331
|
+
artifactAutoNote: (n) => `После удаления в карантин уйдёт файлов: ${n}`,
|
|
332
|
+
artifactAutoOnly: 'Созданные файлы уходят в карантин автоматически, здесь они не перечисляются.',
|
|
333
|
+
artifactRefused: (n) => `Пропущено ещё: ${n}`,
|
|
334
|
+
artifactSelected: (n) => `Выбрано: ${n}`,
|
|
335
|
+
artifactMore: (n) => `Не показано ещё: ${n}`,
|
|
336
|
+
artifactTruncated: 'Список сокращён: всё, что не показано, останется нетронутым.',
|
|
337
|
+
artifactScopeCreated: 'Область: только созданные',
|
|
338
|
+
artifactScopeAll: 'Область: созданные + изменённые',
|
|
339
|
+
artifactModifiedWarn: 'Изменённые существующие файлы (по умолчанию не отмечены):',
|
|
340
|
+
doneQuarantine: (n) => `Сессия удалена, файлов в карантине: ${n}`,
|
|
341
|
+
doneQuarantineFailed: (ok, fail) => `Сессия удалена, в карантине ${ok}, не удалось ${fail}`,
|
|
342
|
+
}
|
|
343
|
+
|
|
241
344
|
let sessionsSvc = null
|
|
242
345
|
let localeSvc = null
|
|
243
346
|
|
|
@@ -245,16 +348,31 @@ window.__ModuleLoader__.load({
|
|
|
245
348
|
if (typeof navigator === 'undefined') return 'zh'
|
|
246
349
|
for (const tag of (navigator.languages || []).concat([navigator.language])) {
|
|
247
350
|
const primary = String(tag || '').toLowerCase().split('-')[0]
|
|
248
|
-
if (primary === 'zh' || primary === 'en') return primary
|
|
351
|
+
if (primary === 'zh' || primary === 'en' || primary === 'ru') return primary
|
|
249
352
|
}
|
|
250
353
|
return 'zh'
|
|
251
354
|
}
|
|
252
355
|
|
|
356
|
+
const dictionaries = { zh, en, ru }
|
|
357
|
+
|
|
358
|
+
// The dictionary the built-in lookup reads: the browser's language when it is
|
|
359
|
+
// one we ship, the historical zh fallback otherwise.
|
|
360
|
+
function activeDictionary() {
|
|
361
|
+
return dictionaries[browserLang()] || zh
|
|
362
|
+
}
|
|
363
|
+
|
|
253
364
|
// The DOM decoration layer (row checkboxes, batch bar, toast) is not a slot
|
|
254
365
|
// occupant, so it has no injected `t`; it uses the built-in dictionaries and
|
|
255
366
|
// honours the registered `locale` namespace when the host provides one.
|
|
256
367
|
// Slot components receive the host-injected `t` and use that instead.
|
|
257
368
|
function t(key, a, b) {
|
|
369
|
+
// A Russian browser reads the plugin's own dictionary first: DSH ships no
|
|
370
|
+
// ru locale, so the host translator would answer in Chinese or English and
|
|
371
|
+
// the Russian strings registered below would never be seen.
|
|
372
|
+
if (browserLang() === 'ru') {
|
|
373
|
+
const own = activeDictionary()[key]
|
|
374
|
+
if (own !== undefined) return typeof own === 'function' ? own(a, b) : own
|
|
375
|
+
}
|
|
258
376
|
if (localeSvc && typeof localeSvc.translate === 'function') {
|
|
259
377
|
try {
|
|
260
378
|
const text = localeSvc.translate(NS, key)
|
|
@@ -263,7 +381,7 @@ window.__ModuleLoader__.load({
|
|
|
263
381
|
// fall back to the built-in dictionaries
|
|
264
382
|
}
|
|
265
383
|
}
|
|
266
|
-
const value = (
|
|
384
|
+
const value = activeDictionary()[key]
|
|
267
385
|
return typeof value === 'function' ? value(a, b) : value || key
|
|
268
386
|
}
|
|
269
387
|
|
|
@@ -288,8 +406,8 @@ window.__ModuleLoader__.load({
|
|
|
288
406
|
// and all. Calling it without params is no better: the host (and this
|
|
289
407
|
// module's own `t`) invoke function entries with no arguments, which
|
|
290
408
|
// produces "已选 undefined 个".
|
|
291
|
-
const
|
|
292
|
-
const local =
|
|
409
|
+
const dict = activeDictionary()
|
|
410
|
+
const local = dict[key]
|
|
293
411
|
if (local !== undefined) {
|
|
294
412
|
if (typeof local === 'function') return local(a, b)
|
|
295
413
|
if (typeof local === 'string' && local.includes('{') && a !== undefined) {
|
|
@@ -310,6 +428,20 @@ window.__ModuleLoader__.load({
|
|
|
310
428
|
return wrapped
|
|
311
429
|
}
|
|
312
430
|
|
|
431
|
+
/**
|
|
432
|
+
* Pick the translator the session-menu rows render through.
|
|
433
|
+
*
|
|
434
|
+
* The host injects a `t` bound to this namespace and stays the authority for
|
|
435
|
+
* the languages DSH itself ships (zh, en): following it is what keeps the menu
|
|
436
|
+
* in step when the UI language is changed in the settings. For a Russian
|
|
437
|
+
* browser there is nothing to follow - DSH ships no ru locale - so the plugin's
|
|
438
|
+
* own dictionary answers first and the rows do not drop back to English.
|
|
439
|
+
*/
|
|
440
|
+
function slotTranslator(injected) {
|
|
441
|
+
const raw = typeof injected === 'function' ? injected : t
|
|
442
|
+
return browserLang() === 'ru' ? localizedTranslator(raw) : raw
|
|
443
|
+
}
|
|
444
|
+
|
|
313
445
|
// --- state -----------------------------------------------------------------
|
|
314
446
|
// One module-level store shared by the slot components and the DOM layer.
|
|
315
447
|
// Components read it through `useSnapshot`, so each stays a plain function of
|
|
@@ -1071,7 +1203,7 @@ window.__ModuleLoader__.load({
|
|
|
1071
1203
|
},
|
|
1072
1204
|
h('span', { key: 'icon', className: 'dsdel-drop-icon' }, glyph(TRASH_PATHS)),
|
|
1073
1205
|
h('span', { key: 'text', className: 'dsdel-drop-text' },
|
|
1074
|
-
armed ? translate('dropRelease', name) : translate('dropHint'
|
|
1206
|
+
armed ? translate('dropRelease', { name }) : translate('dropHint')),
|
|
1075
1207
|
)
|
|
1076
1208
|
}
|
|
1077
1209
|
// Outside selection mode the footer keeps its normal face.
|
|
@@ -1666,7 +1798,8 @@ window.__ModuleLoader__.load({
|
|
|
1666
1798
|
// contract and must not change how the menu looks.
|
|
1667
1799
|
|
|
1668
1800
|
/** "Select multiple" row (order 409, directly above the delete row). */
|
|
1669
|
-
function SelectMultipleMenuItem({ useMenuOpenState, t:
|
|
1801
|
+
function SelectMultipleMenuItem({ useMenuOpenState, t: injected }) {
|
|
1802
|
+
const translate = slotTranslator(injected)
|
|
1670
1803
|
const [, setMenuOpen] = useMenuOpenState()
|
|
1671
1804
|
return h(primitives.MenuItemButton, {
|
|
1672
1805
|
icon: glyph(SELECT_PATHS),
|
|
@@ -1679,7 +1812,8 @@ window.__ModuleLoader__.load({
|
|
|
1679
1812
|
}
|
|
1680
1813
|
|
|
1681
1814
|
/** "Delete session" row (order 410, in the host's danger colour). */
|
|
1682
|
-
function DeleteSessionMenuItem({ sessionId, displayTitle, useMenuOpenState, t:
|
|
1815
|
+
function DeleteSessionMenuItem({ sessionId, displayTitle, useMenuOpenState, t: injected }) {
|
|
1816
|
+
const translate = slotTranslator(injected)
|
|
1683
1817
|
const [, setMenuOpen] = useMenuOpenState()
|
|
1684
1818
|
return h(primitives.MenuItemButton, {
|
|
1685
1819
|
danger: true,
|
|
@@ -2271,7 +2405,7 @@ window.__ModuleLoader__.load({
|
|
|
2271
2405
|
localeSvc = svc || null
|
|
2272
2406
|
if (localeRegistered || !localeSvc || typeof localeSvc.register !== 'function') return
|
|
2273
2407
|
localeRegistered = true
|
|
2274
|
-
const register = () => localeSvc.register(NS, { zh, en })
|
|
2408
|
+
const register = () => localeSvc.register(NS, { zh, en, ru })
|
|
2275
2409
|
try {
|
|
2276
2410
|
if (typeof ctx.effect === 'function') ctx.effect(register, `${NS}: dictionaries`)
|
|
2277
2411
|
else register()
|
|
@@ -669,6 +669,41 @@ test('the locale namespace is registered even when the locale service arrives la
|
|
|
669
669
|
assert.equal(selectRow(harness).element.props.children, '多选')
|
|
670
670
|
})
|
|
671
671
|
|
|
672
|
+
test('the Russian dictionary ships with every key the other dictionaries carry', async () => {
|
|
673
|
+
const harness = await loadPlugin()
|
|
674
|
+
const { ru, zh, en } = harness.locales[NS]
|
|
675
|
+
assert.ok(ru, 'ru reaches the host locale namespace')
|
|
676
|
+
assert.equal(ru.menu, 'Удалить сессию')
|
|
677
|
+
assert.equal(ru.confirm, 'Удалить')
|
|
678
|
+
// A key missing here would fall back to Chinese mid-dialog, so the key sets
|
|
679
|
+
// have to match exactly rather than merely overlap.
|
|
680
|
+
const keys = (dict) => Object.keys(dict).sort()
|
|
681
|
+
assert.deepEqual(keys(ru), keys(zh), 'ru covers exactly the zh key set')
|
|
682
|
+
assert.deepEqual(keys(en), keys(zh), 'en still covers the zh key set')
|
|
683
|
+
})
|
|
684
|
+
|
|
685
|
+
test('a Russian browser gets Russian labels from the built-in dictionary', async () => {
|
|
686
|
+
const harness = await loadPlugin()
|
|
687
|
+
const previous = globalThis.navigator
|
|
688
|
+
Object.defineProperty(globalThis, 'navigator', {
|
|
689
|
+
value: { language: 'ru-RU', languages: ['ru-RU'] },
|
|
690
|
+
configurable: true,
|
|
691
|
+
writable: true,
|
|
692
|
+
})
|
|
693
|
+
try {
|
|
694
|
+
// The host translator in this harness answers in zh; the rows must prefer the
|
|
695
|
+
// plugin's own Russian dictionary instead of following it.
|
|
696
|
+
assert.equal(deleteRow(harness).element.props.children, 'Удалить сессию')
|
|
697
|
+
assert.equal(selectRow(harness).element.props.children, 'Выбрать несколько')
|
|
698
|
+
} finally {
|
|
699
|
+
Object.defineProperty(globalThis, 'navigator', {
|
|
700
|
+
value: previous,
|
|
701
|
+
configurable: true,
|
|
702
|
+
writable: true,
|
|
703
|
+
})
|
|
704
|
+
}
|
|
705
|
+
})
|
|
706
|
+
|
|
672
707
|
test('the delete row asks the host for its danger styling', async () => {
|
|
673
708
|
const harness = await loadPlugin()
|
|
674
709
|
const { element } = deleteRow(harness)
|
|
@@ -2815,4 +2850,37 @@ test('a button-shaped footer entry steps aside without hiding the bar itself', a
|
|
|
2815
2850
|
/\[data-slot="sidebar\.footer\.action"\] > button\{display:none\}/,
|
|
2816
2851
|
'never hide every button unconditionally',
|
|
2817
2852
|
)
|
|
2818
|
-
})
|
|
2853
|
+
})
|
|
2854
|
+
|
|
2855
|
+
test('the drop label names the conversation instead of printing the placeholder', async () => {
|
|
2856
|
+
const harness = await loadPlugin()
|
|
2857
|
+
const row = mountRow(harness, SESSION_A)
|
|
2858
|
+
|
|
2859
|
+
startRowDrag(harness, row)
|
|
2860
|
+
await flush()
|
|
2861
|
+
bar(harness).props.onDragOver(dropEvent())
|
|
2862
|
+
await flush()
|
|
2863
|
+
|
|
2864
|
+
const node = bar(harness)
|
|
2865
|
+
const text = JSON.stringify(node.props.children)
|
|
2866
|
+
|
|
2867
|
+
// The dictionary entry is `松手删除「{name}」`, but the interpolation map carries
|
|
2868
|
+
// `n`/`done`/`total`/`ok`/`fail`/`path` — not `name`. Passing the title as a bare
|
|
2869
|
+
// string therefore left the braces in the label.
|
|
2870
|
+
assert.doesNotMatch(text, /\{name\}/, 'no unsubstituted placeholder in the label')
|
|
2871
|
+
assert.match(text, /松手删除/, 'the sentence is still there')
|
|
2872
|
+
})
|
|
2873
|
+
|
|
2874
|
+
test('the drop label carries the dragged conversation title', async () => {
|
|
2875
|
+
const harness = await loadPlugin()
|
|
2876
|
+
const row = mountRow(harness, SESSION_A)
|
|
2877
|
+
row.textContent = 'BiliLearn-AI 仓库'
|
|
2878
|
+
|
|
2879
|
+
startRowDrag(harness, row)
|
|
2880
|
+
await flush()
|
|
2881
|
+
bar(harness).props.onDragOver(dropEvent())
|
|
2882
|
+
await flush()
|
|
2883
|
+
|
|
2884
|
+
const text = JSON.stringify(bar(harness).props.children)
|
|
2885
|
+
assert.match(text, /BiliLearn-AI 仓库/, 'the title reaches the sentence')
|
|
2886
|
+
})
|