import test from 'node:test' import assert from 'node:assert/strict' import { readSource } from './helpers.ts' // 验收反馈:所有列表都要加分页组件(上一页/下一页,中文由全局 locale 提供)。 // 本轮补齐缺分页的列表:分组管理、软件版本、商品类目搜索表。 // 菜单管理是树结构(非列表),商品类目树用懒加载+加载更多节点,均豁免。 test('align_pagination_normal_primary_path', () => { // 软件版本已像素复刻旧版(panel-version 全量无分页);无 EP 分页列表剩余为 0。 const dh = readSource('src/pages/records/RecordsDigitalHumanVersionPage.vue') assert.match(dh, /page-nums/, '数字人版本用数字页码分页(像素复刻)') }) test('align_pagination_normal_variant_input', () => { // 数字人版本数字页码含上一页/下一页。 const dh = readSource('src/pages/records/RecordsDigitalHumanVersionPage.vue') assert.match(dh, />上一页<\/button>/, '数字人分页含上一页') assert.match(dh, />下一页<\/button>/, '数字人分页含下一页') }) test('align_pagination_boundary_empty_input', () => { // 数字人版本为全量拉取,走客户端切片分页(computed 按 page/pageSize 切)。 const dh = readSource('src/pages/records/RecordsDigitalHumanVersionPage.vue') assert.match(dh, /pagedItems/, '数字人版本应有客户端分页切片') assert.match(dh, /v-for="row in pagedItems/, '表格应绑定分页后的数据') }) test('align_pagination_boundary_single_item', () => { // 类目搜索表从“加载更多”累加改为 el-pagination 换页模式:不再有加载更多按钮与累加拼接。 const src = readSource('src/pages/asin/ProductCategoryPage.vue') assert.ok(!src.includes('加载更多搜索结果'), '搜索表不应再有“加载更多搜索结果”按钮') assert.ok(!src.includes('[...searchRows.value, ...result.items]'), '搜索表不应再累加拼接结果') }) test('align_pagination_repeated_operation_is_idempotent', () => { // 已像素复刻(自绘旧式分页/原生表格)的页单独断言。 const users = readSource('src/pages/account/UsersPage.vue') assert.match(users, /class="pagination"/, '用户页已像素复刻,用旧式分页容器') assert.doesNotMatch(users, /el-pagination/, '用户页不再用 EP 分页') const groups = readSource('src/pages/account/GroupsPage.vue') assert.doesNotMatch(groups, /el-pagination/, '分组管理已像素复刻旧版(panel-group-manage 无分页)') assert.doesNotMatch(groups, /pagedRows/, '分组管理全量渲染无客户端切片') const invalid = readSource('src/pages/asin/AsinInvalidPage.vue') assert.match(invalid, /class="pagination"/, '品牌库已像素复刻,用旧式分页容器') assert.doesNotMatch(invalid, /el-pagination/, '品牌库不再用 EP 分页') const shops = readSource('src/pages/shop/ShopManagePage.vue') assert.match(shops, /class="pagination"/, '店铺管理已像素复刻,用旧式分页容器') assert.doesNotMatch(shops, /el-pagination/, '店铺管理不再用 EP 分页') const keys = readSource('src/pages/shop/ShopKeysPage.vue') assert.match(keys, /class="pagination"/, '店铺密钥已像素复刻,用旧式分页容器') assert.doesNotMatch(keys, /el-pagination/, '店铺密钥不再用 EP 分页') })