fix: 分页文案恢复 Halo 控制台默认(页/条每页/共 N 项数据)

This commit is contained in:
2026-11-21 18:10:38 +08:00
parent bf7573034a
commit f4be39d065
2 changed files with 30 additions and 3 deletions
@@ -0,0 +1,30 @@
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
// 结构性回归测试:不渲染组件,仅检查 SFC 源码中 VPagination 的绑定形态。
// Halo @halo-dev/components 的 VPagination 默认文案即 Halo 控制台风格:
// totalLabel = `共 ${total} 项数据`、pageLabel = `页`、sizeLabel = `条 / 页`。
// 历史上这里覆盖为「页码 / 每页条数 / 共 N 条」,导致分页行与控制台其他页面不一致,
// 本测试防止该覆盖回归。
const sfc = readFileSync(fileURLToPath(new URL('./AuditLogList.vue', import.meta.url)), 'utf-8')
describe('AuditLogList 分页文案', () => {
it('使用 VPagination 默认文案(不覆盖 pageLabel / sizeLabel / totalLabel)', () => {
expect(sfc).toContain('<VPagination')
expect(sfc).not.toMatch(/page-label|pageLabel/)
expect(sfc).not.toMatch(/size-label|sizeLabel/)
expect(sfc).not.toMatch(/total-label|totalLabel/)
})
it('不再出现旧文案(页码 / 每页条数 / 共 N 条)', () => {
expect(sfc).not.toContain('页码')
expect(sfc).not.toContain('每页条数')
expect(sfc).not.toMatch(/共 \$\{total\} 条/)
})
it('分页控件仍在 total > 0 时渲染,且保留每页条数选项', () => {
expect(sfc).toMatch(/v-if="total > 0" class="audit-pagination"/)
expect(sfc).toMatch(/:size-options="\[10, 20, 50\]"/)
})
})