feat: 操作审计列表增加列题头
- 数据行上方新增题头(操作者/时间、动作、资源/路径、结果、IP), 各 VEntityField 固定列宽,与题头列一一对应对齐 - 修复动作列 title 与徽标重复渲染同一文案(POST POST) - 修复结果列状态码徽标不渲染(无 title 时组件不渲染 #extra, 改经 #title 插槽渲染) - 追加结构性回归测试锁定题头结构与列宽对应关系
This commit is contained in:
@@ -6,6 +6,7 @@ import { describe, expect, it } from 'vitest'
|
||||
// 操作审计页需保持控制台默认灰底(.audit-page 不自行设置背景色),
|
||||
// 筛选栏、数据列表、分页条合并为同一张白色卡片:区块之间不留灰缝,
|
||||
// 分页条白底随卡片铺满整行、与上方列表左右对齐(与控制台其他列表页观感一致);
|
||||
// 数据行上方有列题头,题头列宽与数据行各字段固定宽度一一对应;
|
||||
// flex: 1 撑满 main-content 剩余高度,使灰底延伸到页面底部。
|
||||
// 历史上 .audit-page 曾整体铺白导致页面与其他页面观感不一致,
|
||||
// 分页条曾左右各留 1rem 导致白底与上方卡片错位,
|
||||
@@ -46,4 +47,46 @@ describe('AuditLogList 页面外观', () => {
|
||||
expect(rule).toMatch(/padding:\s*1rem/)
|
||||
expect(rule).toMatch(/border-top:\s*1px\s+solid\s+#eaecf0/)
|
||||
})
|
||||
|
||||
it('列表数据行上方渲染列题头,五个列标签齐全', () => {
|
||||
expect(sfc).toContain('<div class="audit-header">')
|
||||
expect(sfc).toContain('操作者 / 时间')
|
||||
expect(sfc).toContain('>动作<')
|
||||
expect(sfc).toContain('资源 / 路径')
|
||||
expect(sfc).toContain('>结果<')
|
||||
expect(sfc).toContain('>IP<')
|
||||
})
|
||||
|
||||
it('题头列宽与数据行 VEntityField 的 width 一一对应', () => {
|
||||
const pairs: Array<[string, string]> = [
|
||||
['col-username', '12rem'],
|
||||
['col-method', '6rem'],
|
||||
['col-resource', '20rem'],
|
||||
['col-status', '4rem'],
|
||||
['col-ip', '9rem'],
|
||||
]
|
||||
for (const [cls, width] of pairs) {
|
||||
expect(sfc, `缺少题头列 ${cls}`).toMatch(new RegExp(`\\.${cls} \\{ width: ${width};? \\}`))
|
||||
expect(sfc, `缺少数据列 width="${width}"`).toContain(`width="${width}"`)
|
||||
}
|
||||
})
|
||||
|
||||
it('题头分组间距与 entity 行一致(start 间距 1rem、end 间距 1.5rem 且右对齐)', () => {
|
||||
const start = styleRule('.header-start')
|
||||
expect(start).toMatch(/gap:\s*1rem/)
|
||||
const end = styleRule('.header-end')
|
||||
expect(end).toMatch(/gap:\s*1\.5rem/)
|
||||
expect(end).toMatch(/margin-left:\s*auto/)
|
||||
const header = styleRule('.audit-header')
|
||||
expect(header).toMatch(/padding:\s*0\.5rem\s+1rem/)
|
||||
expect(header).toMatch(/border-bottom:\s*1px\s+solid\s+#eaecf0/)
|
||||
})
|
||||
|
||||
it('动作列仅保留彩色徽标、结果列徽标经 #title 渲染', () => {
|
||||
// 组件(@halo-dev/components 2.26.0)在无 title/#title 时不渲染 #extra,
|
||||
// 原先结果徽标实际不可见;原先方法列 title 与徽标重复渲染同一文案。
|
||||
expect(sfc).not.toContain(':title="log.spec.method"')
|
||||
expect(sfc).toMatch(/<template #title>\s+<span\s+class="method-badge"/)
|
||||
expect(sfc).toMatch(/<template #title>\s+<span\s+class="status-badge"/)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user