diff --git a/plugin-operation-audit/ui/src/views/AuditLogList.pagination.spec.ts b/plugin-operation-audit/ui/src/views/AuditLogList.pagination.spec.ts new file mode 100644 index 0000000..2b6f961 --- /dev/null +++ b/plugin-operation-audit/ui/src/views/AuditLogList.pagination.spec.ts @@ -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(' { + 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\]"/) + }) +}) diff --git a/plugin-operation-audit/ui/src/views/AuditLogList.vue b/plugin-operation-audit/ui/src/views/AuditLogList.vue index ed34178..924339a 100644 --- a/plugin-operation-audit/ui/src/views/AuditLogList.vue +++ b/plugin-operation-audit/ui/src/views/AuditLogList.vue @@ -294,9 +294,6 @@ onMounted(fetchLogs) v-model:page="page" v-model:size="size" :total="total" - :page-label="'页码'" - :size-label="'每页条数'" - :total-label="`共 ${total} 条`" :size-options="[10, 20, 50]" />