fix(B01): retain native card state and restore mode and confirmation styles

This commit is contained in:
Codex committed 2026-10-21 13:41:18 +09:00
1 parent ddd677bae3
commit 1ed71b63b5
14 files changed
+407 -37

No files matched your search

+17 -1
View File
@@ -41,7 +41,7 @@ async function main() {
check(document.querySelector('[role="dialog"]')?.getAttribute('aria-labelledby'), 'accessible title')
check(document.activeElement === document.querySelector('.task-popconfirm__confirm'), 'confirmation auto-focuses')
check(taskConfirmationCopy('delete', true).confirm === '停止并删除', 'running delete copy')
check(document.querySelector('.task-popconfirm__compatibility')?.textContent?.includes('YCode 暂无此设置入口'), 'archive destination mismatch explicit')
check(!document.querySelector('.task-popconfirm__compatibility'), 'archive preserves selected original copy without extra explanation')
const confirm = document.querySelector('.task-popconfirm__confirm')!
await act(async () => { click(confirm); click(confirm) })
check(calls === 1, 'duplicate confirmation guarded synchronously')
@@ -56,6 +56,22 @@ async function main() {
await act(async () => resolve!())
check(closes === 1 && !document.querySelector('.task-popconfirm'), 'success closes')
await render('delete')
await act(async () => root.render(null))
await act(async () => root.render(<TaskPopconfirm kind="delete" running anchor={anchor} onConfirm={submit} onClose={close} />)); await settle()
const runningConfirm = document.querySelector<HTMLButtonElement>('.task-popconfirm__confirm')!
const runningCancel = document.querySelector<HTMLButtonElement>('.task-popconfirm__cancel')!
check(runningConfirm.textContent === '停止并删除', 'running delete uses stop-and-delete action')
const beforeRunning = calls, beforeRunningClose = closes
await act(async () => { click(runningConfirm); click(runningConfirm); click(runningCancel) })
check(calls === beforeRunning + 1 && closes === beforeRunningClose, 'running delete is single-flight and cancellation locked')
check(runningConfirm.disabled && runningCancel.disabled && runningConfirm.textContent === '处理中…', 'running delete busy buttons remain readable and disabled')
await act(async () => reject!(new Error('stop failed')))
check(document.querySelector('[role="alert"]')?.textContent === 'stop failed', 'stop-and-delete failure retained')
check(!runningConfirm.disabled && runningConfirm.textContent === '停止并删除', 'stop-and-delete failure restores action')
await act(async () => click(runningConfirm))
await act(async () => resolve!())
check(calls === beforeRunning + 2 && closes === beforeRunningClose + 1, 'stop-and-delete retry succeeds once')
await render('delete')
let underlyingClicks = 0
other.addEventListener('click', () => underlyingClicks++)
await act(async () => {