fix(frontend): 批量删除不再逐条弹框/逐条刷新,删完统一报一次总数

This commit is contained in:
2026-11-15 12:31:35 +08:00
parent 1c3395869e
commit 700e7c8518
11 changed files with 148 additions and 64 deletions
@@ -71,7 +71,32 @@ test('记录已不存在时自愈:同步移除本地记录而不是报删除
test('批量删除不再逐条弹二次确认', () => {
assert.match(
boardSource,
/deleteTaskRecord\(.*\{ skipConfirm: true \}\)/,
'批量入口已确认过一次,逐条再弹框会让用户以为批量删除没生效',
/deleteTaskRecord\(.*\{ skipConfirm: true, silent: true \}\)/,
'批量入口已确认过一次,逐条再弹框(确认框或成功提示)会让用户以为批量删除没生效',
)
})
test('批量删除只报一次总数,不逐条弹成功提示', () => {
const fn = boardSource.slice(
boardSource.indexOf('async function batchDeleteHistory'),
boardSource.indexOf('function dispose'),
)
assert.ok(fn.includes('runBatchDelete'), '批量入口必须走 runBatchDelete')
assert.match(
fn,
/已删除 \$\{total\} 条历史记录/,
'删完只报一次总数(含失败时报告成功/失败条数)',
)
assert.match(
fn,
/Promise\.allSettled\(\[loadDashboard\(\), loadHistory/,
'批量删完统一刷新一次列表,不逐条刷新',
)
// 逐条成功提示必须被 silent 挡住:silent 模式下单条函数不再弹「已删除」
const single = boardSource.slice(
boardSource.indexOf('async function deleteTaskRecord'),
boardSource.indexOf('async function batchDeleteHistory'),
)
assert.match(single, /if \(opts\.silent\) return/, 'silent 模式必须跳过逐条刷新与成功提示')
assert.match(single, /if \(opts\.silent\) throw e/, 'silent 模式下单条失败要抛错交给批量计数')
})