✨ feat: 重构管理后台并增强组件系统与回收站功能
* 新增自适应数值与窗口分析工具,提升交互体验 * 优化回收站模块逻辑,增加展示与选择功能 * 引入 Macaron 主题配置文件并更新 Tailwind 配置 * 精简基础组件代码,移除冗余样式与设置项 * 完善测试用例,覆盖 UI 系统与回收站工作流 * 更新多语言配置,支持功能变更后的文案需求
This commit is contained in:
1 parent
614b9a2104
commit
9b22534e2b
61 files changed
+1624
-832
No files matched your search
@@ -0,0 +1,61 @@
|
||||
// Only run on the isolated localhost in-memory backend fixture, never production.
|
||||
export async function runTrashWorkflowChecks() {
|
||||
if (location.hostname !== '127.0.0.1' || location.port !== '5180') throw new Error('Use the isolated fixture on port 5180')
|
||||
const output=document.createElement('pre')
|
||||
output.style.cssText='position:sticky;top:0;z-index:100;white-space:pre-wrap;background:#e6f0eb;color:#284b3b;padding:10px;font-size:12px'
|
||||
document.body.prepend(output)
|
||||
const checks=[]
|
||||
const wait=async(fn)=>{const end=Date.now()+6000;while(!fn()){if(Date.now()>end)throw new Error('等待页面状态超时');await new Promise(r=>setTimeout(r,30))}}
|
||||
const button=(text,root=document)=>[...root.querySelectorAll('button')].find(e=>e.textContent.trim()===text)
|
||||
const done=text=>{checks.push(text);output.textContent=checks.join('\n')}
|
||||
const assert=(v,m)=>{if(!v)throw new Error(m)}
|
||||
const submit=()=>document.querySelector('form').dispatchEvent(new Event('submit',{bubbles:true,cancelable:true}))
|
||||
try {
|
||||
await wait(()=>document.querySelectorAll('article').length===6)
|
||||
const keyword=document.querySelector('form input')
|
||||
keyword.value='示例记录-1.txt';keyword.dispatchEvent(new Event('input',{bubbles:true}));submit()
|
||||
await wait(()=>document.querySelectorAll('article').length===1)
|
||||
assert(document.querySelector('article').textContent.includes('示例记录-1'),'关键词命中错误')
|
||||
done('通过:全量文件名筛选')
|
||||
button('重置').click();await wait(()=>document.querySelectorAll('article').length===6)
|
||||
const status=document.querySelector('form select');status.value='purged';status.dispatchEvent(new Event('change',{bubbles:true}));submit()
|
||||
await wait(()=>document.querySelectorAll('article').length===1)
|
||||
assert(document.querySelector('article input').disabled,'审计记录可被选中')
|
||||
assert(!button('恢复',document.querySelector('article')),'审计记录出现恢复操作')
|
||||
done('通过:状态筛选与已删除记录禁用')
|
||||
button('重置').click();await wait(()=>document.querySelectorAll('article').length===6)
|
||||
document.querySelector('input[type=checkbox]').click()
|
||||
await wait(()=>button('设置清理时间'))
|
||||
assert([...document.querySelectorAll('article input')].filter(e=>e.checked).length===5,'全选未排除已清理记录')
|
||||
button('设置清理时间').click();await wait(()=>document.querySelector('[role=dialog]'))
|
||||
let modal=document.querySelector('[role=dialog]')
|
||||
modal.querySelector('input[type=checkbox]').click();button('保存时间',modal).click()
|
||||
await wait(()=>!document.querySelector('[role=dialog]'))
|
||||
await wait(()=>document.querySelectorAll('article').length===6)
|
||||
assert([...document.querySelectorAll('article')].filter(e=>e.textContent.includes('不自动清理')).length===5,'批量永久保留未生效')
|
||||
done('通过:批量永久保留与全选排除审计记录')
|
||||
const record=[...document.querySelectorAll('article')].find(e=>button('清理时间',e))
|
||||
button('清理时间',record).click();await wait(()=>document.querySelector('[role=dialog]'))
|
||||
modal=document.querySelector('[role=dialog]');modal.querySelector('input[type=checkbox]').click()
|
||||
await wait(()=>modal.querySelector('select'))
|
||||
const year=modal.querySelector('select');const original=year.value;year.value='2020';year.dispatchEvent(new Event('change',{bubbles:true}));button('保存时间',modal).click()
|
||||
await wait(()=>modal.querySelector('[role=alert]'))
|
||||
assert(modal.textContent.includes('未来 365 天'),'日期校验提示缺失')
|
||||
year.value=original;year.dispatchEvent(new Event('change',{bubbles:true}));button('保存时间',modal).click()
|
||||
await wait(()=>!document.querySelector('[role=dialog]'))
|
||||
done('通过:单条时间编辑与无效日期拦截')
|
||||
await wait(()=>document.querySelectorAll('article').length===6)
|
||||
const selectable=[...document.querySelectorAll('article input')].filter(e=>!e.disabled)
|
||||
selectable[0].click();await new Promise(r=>setTimeout(r,0));selectable[1].click();await new Promise(r=>setTimeout(r,0));await wait(()=>button('批量恢复'));assert([...document.querySelectorAll('article input')].filter(e=>e.checked).length===2,'未选中两条记录')
|
||||
button('批量恢复').click();await wait(()=>document.querySelectorAll('article').length===4)
|
||||
assert(document.querySelectorAll('code').length===2,'未展示恢复后的新取件码')
|
||||
done('通过:批量恢复、列表刷新和新取件码展示')
|
||||
document.querySelector('input[type=checkbox]').click();await wait(()=>button('批量清理'))
|
||||
button('批量清理').click();await wait(()=>document.querySelector('[role=dialog]'))
|
||||
modal=document.querySelector('[role=dialog]');assert(modal.textContent.includes('不可恢复')&&modal.textContent.includes('3'),'缺少删除数量或后果提示')
|
||||
button('取消',modal).click();await wait(()=>!document.querySelector('[role=dialog]'))
|
||||
assert(document.querySelectorAll('article').length===4,'取消删除改变了数据')
|
||||
done('通过:彻底删除确认数量、取消不修改数据')
|
||||
done('全部 6 组交互检查通过(独立内存数据库)')
|
||||
} catch(error) {output.textContent=checks.join('\n')+'\n失败:'+error.message;throw error}
|
||||
}
|
||||
Reference in new issue
Block a user