fix: 操作审计题头结果/IP 列与数据列对齐(镜像 entity 行两 td 盒模型)

VEntity 数据行由两个自带 1rem 左右内边距的 td 组成,end 组紧跟 start 组;
题头原先用 margin-left: auto 把结果/IP 推到行尾,与数据列错位 19rem。
现改为题头 start/end 两组各自镜像 1rem 内边距、end 组不再右推。
已用真实 @halo-dev/components CSS + 同构 DOM 在浏览器实测:五列偏差均为 0。
This commit is contained in:
2026-11-21 19:33:54 +08:00
parent 7280ccb5f3
commit 55c50706b5
2 changed files with 18 additions and 8 deletions
@@ -6,7 +6,8 @@ import { describe, expect, it } from 'vitest'
// 操作审计页需保持控制台默认灰底(.audit-page 不自行设置背景色),
// 筛选栏、数据列表、分页条合并为同一张白色卡片:区块之间不留灰缝,
// 分页条白底随卡片铺满整行、与上方列表左右对齐(与控制台其他列表页观感一致);
// 数据行上方有列题头,题头列宽与数据行各字段固定宽度一一对应;
// 数据行上方有列题头,题头列宽与数据行各字段固定宽度一一对应,
// 且题头 start/end 两组各自镜像 entity 行两个 td 的 1rem 左右内边距(end 组紧跟 start 组);
// flex: 1 撑满 main-content 剩余高度,使灰底延伸到页面底部。
// 历史上 .audit-page 曾整体铺白导致页面与其他页面观感不一致,
// 分页条曾左右各留 1rem 导致白底与上方卡片错位,
@@ -71,14 +72,19 @@ describe('AuditLogList 页面外观', () => {
}
})
it('题头分组间距与 entity 行一致(start 间距 1rem、end 间距 1.5rem 且右对齐)', () => {
it('题头分组间距与 entity 行一致(start 间距 1rem、end 间距 1.5rem 且不右对齐)', () => {
// entity 行由两个自带 1rem 左右内边距的 td 组成,end 组紧跟 start 组(行宽随内容收缩);
// 题头两组各自镜像 1rem 内边距才能与数据列对齐,
// 历史上曾用 margin-left: auto 把结果/IP 推到行尾导致与数据错位 19rem,本测试防止回归。
const start = styleRule('.header-start')
expect(start).toMatch(/gap:\s*1rem/)
expect(start).toMatch(/padding:\s*0\s+1rem/)
const end = styleRule('.header-end')
expect(end).toMatch(/gap:\s*1\.5rem/)
expect(end).toMatch(/margin-left:\s*auto/)
expect(end).toMatch(/padding:\s*0\s+1rem/)
expect(end).not.toMatch(/margin-left:\s*auto/)
const header = styleRule('.audit-header')
expect(header).toMatch(/padding:\s*0\.5rem\s+1rem/)
expect(header).toMatch(/padding:\s*0\.5rem\s+0/)
expect(header).toMatch(/border-bottom:\s*1px\s+solid\s+#eaecf0/)
})